Why the line-height attribute in IE6 browser does not work, ie6line-height
Why is the line-height attribute unavailable in IE 6 browsers:
Suggestion: writing code as much as possible can effectively improve learning efficiency and depth.
Not all situations will cause the line-height attribute to expire in the IE 6 browser, but will be encountered only under specific conditions. For example, the following code is normal:
<! DOCTYPE html>
The above code runs normally in IE browser. Let's look at the following situation:
<! DOCTYPE html>
The above Code seems to be vertical center in other mainstream browsers (if you observe carefully, you will find that there is no precise center), but in IE6, line-height is permanently invalid. That is to say, if the text is used together with elements such as img, input, textarea, select, and bject, this will happen.
The solution is as follows:
Add the margin attribute and vertical-align attribute to elements such as img, input, textarea, select, and bject. Set the attributes of margin-top and margin-bottom: the line-height value minus the height of the corresponding element and then divided by two. The above code is modified as follows:
<! DOCTYPE html>
However, the above Code can only be used for vertical center alignment under IE6 (precise vertical center alignment), but it can only look like vertical center in other browsers, except for images, you can achieve precise vertical center alignment in any browser. That is to say, if it is a form label, it is recommended to use padding to precisely align vertically.
The original address is http://www.51texiao.cn/div_cssjiaocheng/2015/0405/145.html