The CSS code writing sequence of font and line-height is different, resulting in different display effects

Source: Internet
Author: User

We accidentally discovered that when the font and line-height attributes are applied to the same HTML Tag in CSS at the same time, we had to be careful. The writing sequence of the two is different, which may lead to different display effects.
That is:
>>> If you write font first and then line-height, the result is normal.
>>> If line-height is first written and font is written, the effect of line-height definition will be lost. This bug occurs in IE, Firefox, and opera.

For more information, see the following.Code:

<P> H1: </P>
<H1 style = "Background: # f00; margin: 5px 0; Font: bold 20px, Geneva, Arial, sans-serif; line-Height: 40px;"> IECN. net-Focus on web technology and experience development! </H1>
<H1 style = "Background: # f00; margin: 5px 0; line-Height: 40px; Font: bold 20px, Geneva, Arial, sans-serif;"> IECN. net-Focus on web technology and experience development! </H1>

<P> Div: </P>
<Div style = "Background: # f00; margin: 5px 0; Font: bold 20px, Geneva, Arial, sans-serif; line-Height: 40px;"> IECN. net-Focus on web technology and experience development! </Div>
<Div style = "Background: # f00; margin: 5px 0; line-Height: 40px; Font: bold 20px, Geneva, Arial, sans-serif;"> IECN. net-Focus on web technology and experience development! </Div>

Http://www.cnlei.org/blog/article.asp? Id = 343

Note: I read fengyan's message and checked the CSS help document.

Reference
The parameters defined for font must be arranged in the following order. Each parameter can have only one value. If this parameter is ignored, the default value of the independent attribute corresponding to the parameter is used:
Font: font-style | font-variant | font-weight | font-size | Line-height | font-family
Example: P {Font: italic small-caps 600 12pts/18pts ;}

Author: ztu http://www.dnew.cn/post/217.htm#topreply

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.