Home > Web Front-end > CSS Tutorial > How to set the font style of css

How to set the font style of css

coldplay.xixi
Release: 2023-01-03 09:29:38
Original
8760 people have browsed it

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].

How to set the font style of css

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 fontAttributes can also define font types.

font-family:name
Copy after login

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
Copy after login

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 "隶书";
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template