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

Detailed explanation of how to use grep to obtain MySQL error log information

To facilitate the maintenance of MySQL, a script ...

Detailed tutorial on installing mysql 8.0.13 (rpm) on Centos7

yum or rpm? The yum installation method is very c...

vue-pdf realizes online file preview

This article example shares the specific code of ...

How to recover files accidentally deleted by rm in Linux environment

Table of contents Preface Is there any hope after...

js to achieve a simple magnifying glass effect

This article shares the specific code of js to ac...

Sample code for implementing horizontal infinite scrolling with pure CSS3

The examples in this article are all written in s...

Learn SQL query execution order from scratch

The SQL query statement execution order is as fol...

HTML Grammar Encyclopedia_HTML Language Grammar Encyclopedia (Must Read)

Volume Label, Property Name, Description 002 <...

How to implement the King of Glory matching personnel loading page with CSS3

Those who have played King of Glory should be fam...

A complete guide to clearing floats in CSS (summary)

1. Parent div defines pseudo-classes: after and z...

MySQL functional index optimization solution

When using MySQL, many developers often perform f...

How to stop CSS animation midway and maintain the posture

Preface I once encountered a difficult problem. I...