Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the shorthand rules for CSS font properties

Shulou Source: shulou.com Published: 2022-06-01 05:41:05 10月02日 Update

This article mainly introduces what the abbreviation rules of CSS font attributes are. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

Shorthand rules for CSS font properties

Generally, setting font properties with CSS is done like this:

Font-weight:bold; font-style:italic; font-varient:small-caps; font-size:1em; line-height:1.5em; font-family:verdana,sans-serif

But you can also write them all on one line:

Font:bolditalicsmall-caps1em/1.5emverdana,sans-serif

Just one caveat: this shorthand method works only if both the font-size and font-family properties are specified. Also, if you don't set font-weight,font-style and font-varient, they will use the default, which should be noted.

The above is all the content of the article "what are the abbreviation rules for CSS font attributes?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Attributes fonts abbreviations rules content only articles lines values functions interests at the same time guys partners methods more knowledge industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Redmi MySQL NVidia Shulou Technology