Home  >  Article  >  Web Front-end  >  What are the font styles in css

What are the font styles in css

王林
王林Original
2023-05-29 14:06:383004browse

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:

  1. font-size: Set the font size, you can use relative units (such as em, %) or absolute units (such as px , pt).
  2. 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.
  3. 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).
  4. font-style: Set the font style, you can set the value to normal (normal font), italic (italic font) or oblique (italic font).
  5. font-variant: Set the font variant. You can set the value to normal (normal font) or small-caps (small capital letters).
  6. 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).
  7. 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!

Statement:
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
Previous article:jq sets css styleNext article:jq sets css style