CSS is a language used for web page style expression, in which font style is also an important part of it. In CSS, font style can be controlled through the font attribute. The specific style is as follows:
- font-size: Set the font size, you can use relative units (such as em, %) or absolute units (such as px , pt).
- font-family: Set the font family, that is, set the font type that can be used to display text. You can set multiple font types. If the browser does not support the first font, it will try the second font. , and so on.
- font-weight: Set the font weight. You can set normal (normal font) and bold (bold font). You can also set relative thickness keywords (lighter, bolder) or numbers (100~900, where 100 is the thinnest and 900 is the thickest).
- font-style: Set the font style, you can set the value to normal (normal font), italic (italic font) or oblique (italic font).
- font-variant: Set the font variant. You can set the value to normal (normal font) or small-caps (small capital letters).
- font-stretch: Set the font stretching effect. The values can be set to normal (normal font), condensed (compressed font), expanded (expanded font), extra-condensed (extremely compressed font), extra-expanded (extremely expanded font), semi-condensed (semi-compressed font), semi-expanded (semi-expanded font).
- line-height: Set the line height, which is also an important part when displaying text. The value can be set to a normal value or a specific pixel value or percentage.
In general, CSS provides a very rich font style. You can use these styles to finely control the display effect of text, making the web page more beautiful and easy to read.
The above is the detailed content of What are the font styles in css. For more information, please follow other related articles on the PHP Chinese website!