15th Chapter CSS Text Styles
First, Font summary
Second, font settings
1,font-size
(1)Xx-small}
(2)X-small}
(3)Small} sets the size of the font, each value from small to large fixed value
(4)Mediue}
(5)Large}
(6)X-large}
(7)Xx-large}
example,p{
font-size:50px;
}
(8)Smaller} sets the font size relative to the parent element font
(9)larger}
example,body{
font-size:50px; the size of the parent element font
}
p{
Font-size:smaller; A little bit smaller than the parent element
}
() digital +px
(one) the number +% The percentage size of the parent element font. // same (9)
2.font-variant Sets whether the font is displayed in small caps
(1)normal indicates that if a small capitalization state, let him restore the lowercase state.
(2)small-caps lowercase letters in small caps.
3,font-style
(1) Normal indicates that italic body is restored to normal state
(2)italic means using italic
(3)oblique means to tilt the text. The difference is used when there is no italic.
4,font-weight
(1) normal means to return the bold font to normal
(2) Bold boldface
(3)bolder more coarse fonts
(4)lighter light and thin font
(5) The number between the years and the following is bold, not bold
5,font-family
example,p{
Font-family: italics, Microsoft Ya-hei, Arial; // If there is no italics in the computer, see if there is no Microsoft black, and so on, if there is no Arial, then the system to restore the system default font.
}
6, font fonts Set shorthand combination method. The format is as follows:
[whether to tilt ] [whether to bold ] [to turn small caps ] Font Size font name
p{
Font:small-caps Italic Bold 50px italic ; elements with [] can be adjusted to each other, and the font size font name in front is invalidated.
}
Third, Web fonts (although the use of a fallback font to solve the problem of user-side font missing, but the overall user experience is not good, and not necessarily all users are installed,
so CSS provides Web fonts, which are server-side fonts)
1,@font-face{
FONT-FAMILY:ABC;
Src:url (' font filename ');
}
p{
font-size:50px;
FONT-FAMILY:ABC;
}
English font is relatively small, and the Chinese font is very large, so, Chinese fonts want to use special fonts can use the picture, large areas of Chinese fonts are not recommended.
18.CSS Text Style "on"