English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules

Complete List of CSS Properties

CSS font-variant attribute usage and examples

font-The variant attribute sets the font display text to small uppercase letters, which means that all lowercase letters will be converted to uppercase, but the letters using small uppercase letters are smaller in font size compared to the rest of the text

The following table provides usage instructions and version history of this attribute, as well as the syntax of using this attribute in the JavaScript script.

Default value:normal
Applicable to:All elements
Inheritance:Yes
Can be animated:No.Please see Animation attribute.
Version:CSS 1,2,3

font-variant usage syntax

The syntax of this attribute is as follows:

font-variant: normal | small-caps | initial | inherit

The following examples demonstrate how to use font-variant attribute.

  p {
   font-variant: small-caps;
  }
Test and see‹/›

Attribute value

The following table describes the value of this attribute.

ValueDescription
normalSpecify a normal font.
small-capsSpecify the font marked as lowercase. If the lowercase font cannot be used, the browser will simulate this variant, using a regular font, and replace lowercase letters with smaller uppercase letters.
initialSet this attribute to its default value.
inheritIf specified, the associated elements adopt the font of their parent element font-The variant attribute values.

Note:   In small-In caps font, lowercase letters look similar to uppercase letters but are smaller in size, and the proportions are slightly different.

Browser compatibility

font-Browser compatibility of the variant attribute, the numbers in the table below represent the minimum version number of the browser that supports this attribute; all mainstream browsers support this attribute.

  • Firefox 1+

  • Google Chrome1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 3.5+

Further reading

Please refer to the following tutorials:CSS font,CSS text.

Related attributes and rules:font,font-style,font-weight,font-size,line-height,font-family,@font-face.