Solve the problem that the borders of the search box and the search button cannot overlap

Solve the problem that the borders of the search box and the search button cannot overlap

Today, when I was practicing with the Baidu page, I suddenly found that even though the margin and padding values ​​of the search box and button were set to 0, their borders still could not overlap (I didn't want to use position)

insert image description here

I asked the teacher, who said that I could just set the font-size of their parent element to 0. Because the text content of the parent element has a default font-size, the spacing between the two elements can never completely overlap, so setting the font-size will solve the problem perfectly.

insert image description here

But due to Tag attributes can be inherited, and you should also pay attention to whether the text content in the sub-tags is affected. If so, you should set it separately.
When modifying the font-size value in the Chrome console, it is found that as long as it is not 0, the two boxes will be separated to a fixed distance, no matter how large the value is.

Summarize

This concludes this article on how to solve the problem of the search box and search button borders not overlapping. For more related content about the search box and search button not overlapping, please search 123WORDPRESS.COM’s previous articles or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  In-depth analysis of HTML table tags and related line break issues

>>:  Detailed explanation of Vue3 life cycle functions and methods

Recommend

How to use Navicat to export and import mysql database

MySql is a data source we use frequently. It is v...

Ubuntu 19.04 installation tutorial (picture and text steps)

1. Preparation 1.1 Download and install VMware 15...

How to implement the strategy pattern in Javascript

Table of contents Overview Code Implementation Su...

Docker builds python Flask+ nginx+uwsgi container

Install Nginx First pull the centos image docker ...

JS gets the position of the nth occurrence of a specified string in a string

Learn about similar methods for getting character...

A brief discussion on the semantics of HTML and some simple optimizations

1. What is semanticization? Explanation of Bing D...

MySQL optimization tutorial: large paging query

Table of contents background LIMIT Optimization O...

Detailed graphic explanation of mysql query control statements

mysql query control statements Field deduplicatio...

MySQL fuzzy query statement collection

SQL fuzzy query statement The general fuzzy state...

How to implement Mysql switching data storage directory

How to implement Mysql switching data storage dir...

SSM implements the mysql database account password ciphertext login function

introduction Our company is engaged in the resear...

Do you know how to use vue-cropper to crop pictures in vue?

Table of contents 1. Installation: 2. Use: 3. Bui...