Home > Article > Web Front-end > How to set the font style of css
How to set the css font style: 1. Use the [font-family] attribute to define the font type, the code is [font-family:name]; 2. Use the font attribute to also define the font type, the code is [font:font-style].
The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.
How to set css font style:
CSS uses the font-family
attribute to define the font type, and also uses font
Attributes can also define font types.
font-family:name
name represents the font name. Multiple fonts can be specified. Multiple fonts will be arranged in priority order and separated by commas. If the font name contains spaces, it should be enclosed in quotes.
font is a composite attribute. The so-called conforming attribute means that this attribute can set multiple font attributes. The usage is as follows:
font:font-style || font-variant || font-weight || font-size || line-height || font-family
The attribute values are separated by spaces. The font attribute should at least set the font size and font type, and must be placed behind, otherwise it will be invalid. You can freely define font style, font weight, upper and lower case and line height at the front.
body{ font-family:Arial,Helvetica,sans-serif; } p{ font:24px "隶书"; }
Recommended related tutorials: CSS video tutorial
The above is the detailed content of How to set the font style of css. For more information, please follow other related articles on the PHP Chinese website!