In IE9, the DIV + CSS webpage is often written. Sometimes the text cannot be vertically centered and line-height is invalid. Even if you can set the compatibility mode of IE browser, however, for visitors, it is impossible for everyone to set the compatible mode for browsing. This is only a solution to hide your ears and ears. What should we do? I had to search for it. Baidu only found the reason. The original reason why IE9 does not support line-height is that Chinese ie9 does not support English fonts, and I just used English fonts.
On IE9, you can see that you can use line-height to set vertical center text to not vertical center. This is related to the font setting.
The code is as follows: |
Copy code |
Font-family: Arial, Helvetica, sans-serif; |
Solution to line-height failure in ie9:
You only need to set the font and add a to solve the problem, such as CSS code.
The code is as follows: |
Copy code |
Font-family: Arial, "", Helvetica, sans-serif; |
Note when setting the font. You also need to set the default font that comes with the system, such as,.
In Chinese IE9, the English font is not recognized, so IE9 cannot find the set Chinese font, which causes the font to become vertical and vertical.
If only Chinese fonts are used in CSS, we can convert the Chinese font name to Unicode encoding.
Unicode conversion example:
: 5B8B4F53
Simhei: 9ED14F53
5: 5FAE8F6F96C59ED1
You can remember to save the above URL for reference when converting Chinese to Unicode during CSS development.
As follows:
The code is as follows: |
Copy code |
Div {font-family: "";} After transfer: www.111cn.net Div {font-family: "5B8B4F53 ";} |
Note when setting the font. You also need to set the default font that comes with the system, such as,.
In Chinese IE9, the English font is not recognized, so IE9 cannot find the set Chinese font, which causes the font to become vertical and vertical.
Example:Convert Chinese characters in Chinese fonts to Unicode encoding
After converting a Chinese character to a Unicode character, the font effect is the same, not affected, and compatible with various browsers.
After converting Chinese characters to Unicode characters, the corresponding font is successfully set and compatible with the vertical center line-height style supported by the IE 9 browser.
For example:
The code is as follows: |
Copy code |
. Div {font-family: ""} After conversion to Unicode encoding . Div {font-family: "5FAE8F6F96C59ED1 "} |
Example B:Use Chinese characters in Chinese fonts as English names
In the CSS + DIV layout, set the Chinese font to the English font corresponding to the Chinese font. After the conversion, set the Chinese font effect unchanged and be compatible with various browsers.
For example:
The code is as follows: |
Copy code |
. Div {font-family: ""} After converting to English name . Div {font-family: "Microsoft YaHei "} |