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

Linux Cron scheduled execution of PHP code with parameters

1. Still use PHP script to execute. Command line ...

Method of iframe adaptation in web responsive layout

Problem <br />In responsive layout, we shou...

Bootstrap realizes the effect of carousel

This article shares the specific code of Bootstra...

Solution for Docker Swarm external verification load balancing not taking effect

Problem Description I created three virtual machi...

Example of using CSS3 to customize the style of input multiple-select box

Principle: First hide the input element, then use...

How to transfer files between Windows and Linux

File transfer between Windows and Linux (1) Use W...

Comprehensive understanding of Node event loop

Table of contents Node Event Loop Event loop diag...

Prototype and prototype chain prototype and proto details

Table of contents 1. Prototype 2. Prototype chain...

Web page layout should consider IE6 compatibility issues

The figure below shows the browser viewing rate i...

CSS implements six adaptive two-column layout methods

HTML structure <body> <div class="w...

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...

Solve the problem of MySql client exiting in seconds (my.ini not found)

Problem description (environment: windows7, MySql...

Specific usage of fullpage.js full screen scrolling

1.fullpage.js Download address https://github.com...

Vue-CLI multi-page directory packaging steps record

Page directory structure Note that you need to mo...