When line-height is 0, the vertical alignment of the text input box input and button makes me confused.

question 1: I used line-height:0; on the input [type = text] button and didn"t get what it looks like using the same line height of 0 on ordinary span elements. Is there any feature of form elements like input,button that affects internal text positioning?

question 2: in chrome, there will be a deviation of 1 pixel between input and button in the vertical position. If vertical-align is set to middle, the outer frames of the two will be vertically aligned, but the vertical difference between the middle text will be 1 pixel (with the bottom edge of x as a reference)

want to know the nature of these two problems


the red line in the picture indicates the baseline alignment of the text, and the green line indicates the 1-pixel difference between input and button

this is true for problem 1 Chrome,firefox,Edge on PC, and question 2 only appears in Chrome

.

related codes


< html lang= "zh" >
< head >

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title></title>
<style type="text/css">
    .test{ padding:20px;}
    .test>*{ display:inline-block; line-height:0; margin:0; padding:0; border:1px solid -sharpccc; -webkit-appearance:none; height:100px; background:-sharpeee;  box-sizing: border-box; font-size:20px;}
</style>

< / head >
< body >

<div class="test">
    <span>xyz</span>
    <input type="text" value="xyz"/>
    <button>xyz</button>
</div>

< / body >
< / html >

Sep.16,2021

I have encountered this problem before. In different browsers, the display style is different. Later, I used div, and did not have this phenomenon.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5afbe-455ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5afbe-455ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?