CSS font style attributes

font-size: font size

font-size property is used to set the font size, the value of the property can be used relative length unit, an absolute length units may also be used.

Wherein the relative length units commonly used, we recommend the pixel unit px, use less absolute length units. details as follows:

font-family: font

font-family property is used to set the font. Web page commonly used fonts are Arial, Microsoft elegant black, black body and so on, such as the pages of all paragraphs of text font is set to Microsoft elegant black, can use the following CSS style code:

p {font-family: "Microsoft yahei";}

You can specify multiple fonts at the same time, in the middle separated by commas, said that if the browser does not support the first font, it tries the next one, until you find the right font.

Skills
 1 is now commonly used pages + 14px .
2 . Try to an even number size. ie6 and other older browsers will support the odd bug.
3 must be separated by a comma in the English state between. Various fonts.
4 . Chinese fonts require quotation marks in the state plus English, English fonts generally do not need quotes. English when you need to set the font, the font name must be in English before the Chinese font name.
5 . If the font name contains a space, #, $ and other symbols, fonts must be added to the single or double quotation marks in the English state, e.g. Family-font: " Times New Roman " ;.
6 . Try to use the system default font, to ensure that any user can display correctly in the browser.

CSS Unicode fonts

Set the font name in the CSS, the direct write Chinese is possible. However, in the encoding file (GB2312, UTF-8, etc.) will produce distortion mismatch errors. xp system does not support similar to Microsoft elegant black Chinese.

Option One: You can use English instead. For example, font-family: "Microsoft Yahei".

Option Two: Use Unicode encoded directly in the CSS to write the name of the font to avoid these errors. Use Unicode font to write Chinese name, the browser can correct resolution. font-family: "\ 5FAE \ 8F6F \ 96C5 \ 9ED1", set the font to represent "Microsoft elegant black."

 

You can escape () to test what belongs font.

font-weight: The font weight

In addition to using bold font b and strong tags, you can use CSS to achieve, but CSS is not semantics.

 Thickness font-weight property is used to define the font, attribute values ​​which can be used: normal, bold, bolder, lighter, (an integer multiple of 100) 100 to 900.

skill:

 Number 400 is equivalent to the normal, and 700 is equivalent to bold. But we prefer to use numbers to represent.  

font-style: font style

In addition to italic by i and em tags may be implemented using CSS, but there is no semantic CSS.

font-style attribute is used to define the font style, such as setting italic, oblique or normal font property values ​​which can be used as follows:

normal: default browser will display the standard font style.

italic: browser displays italic font style.

oblique: The browser displays the tilt font style.

skill:

 Usually we rarely give italic text, but like to italic tag (em, i) changed to the normal mode.

font: Comprehensive set the font style (focus)

font attributes for a comprehensive set font style, the basic syntax is as follows: 

选择器{font: font-style  font-weight  font-size/line-height  font-family;} 

When using the font attribute syntax must be above order in writing, you can not change order, each separated by a space attributes.
Note: these properties need not be provided may be omitted (the default value), but must retain the font-size attribute and font-family, font property will not work otherwise. 
 

 

 

Guess you like

Origin www.cnblogs.com/superjishere/p/11642226.html