Font and line-height CSS code writing sequence, resulting in a different display effect _ Experience Exchange
Source: Internet
Author: User
Inadvertently found that for the same HTML tag, in the CSS in the application of both the font and Line-height properties, you have to be careful, the two writing order is not the same, will result in different display effects.
That
>>> If you write font first, then write Line-height, the display works
>>> If you write Line-height first, then write font, the line-height definition of the effect will be lost, in IE, Firefox, opera under the bug
See the following code for a specific effect:
<p>h1:</p>
<H1 style= "background: #f00; margin:5px 0;font:bold 20px song body, geneva,arial,sans-serif;line-height:40px;" >iecn.net-Focus on web technology, experience development fun! <H1 style= "background: #f00; margin:5px 0;line-height:40px;font:bold 20px song body, Geneva,arial,sans-serif;" >iecn.net-Focus on web technology, experience development fun!
<p>div:</p>
<div style= "background: #f00; margin:5px 0;font:bold 20px song body, geneva,arial,sans-serif;line-height:40px;" >iecn.net-Focus on web technology, experience development fun! </div>
<div style= "background: #f00; margin:5px 0;line-height:40px;font:bold 20px song body, Geneva,arial,sans-serif;" >iecn.net-Focus on web technology, experience development fun! </div>
Note: Read the Maple rock message, to check the next CSS Help document
Reference
The definition parameters for font must be sorted in the following order. Only one value is allowed per parameter. Ignores the default values for independent properties that will be used for their arguments:
Font:font-style | | Font-variant | | Font-weight | | Font-size | | Line-height | | Font-family
Example: p {font:italic small-caps 12pts/18pts Arial;}
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