In special cases, the parent element and the input element high degree of inconsistency, and brother element input level of the problem are not aligned vertical-align: baseline;

Park arrived blog, recording my humble opinion, Public Hearing hyun made.

The following code, since a div coexistence of two different type of input, wherein when the type of the value argument Chinese text, the parent will result in a highly div element is stretched and the two sub-elements not in the same horizontal line, after several tests and found that because of the default text
Property vertical-align: baseline; value when the value of Chinese text baseline vertical center, resulting in the above results.
Under given individual solution:
1. Add to the input pattern vertical-align: middle; or vertical-align: top;
2. add style to the input line-height: 20px;
<style>
 div {
    background: pink;
    width: 340px;
  }

  input {
    height: 20px;
    width: 130px;
    border: 1 solid #ccc;
  }

</style>

<body>
  <div>
    <input type="text" value="汉字">
    <input type="password" value="123">
<body>

 

Guess you like

Origin www.cnblogs.com/minghost/p/11265287.html