Style fontVariant attribute
- Föregående sida fontStyle
- Nästa sida fontWeight
- Gå tillbaka till föregående nivå HTML DOM Style Objekt
Definition and usage
fontVariant
Attribute sets or returns whether the font is displayed as small capitals.
This means that all lowercase letters will be converted to uppercase, but these letters will have a smaller font size compared to the rest of the text.
See also:
CSS Tutorial:CSS teckensnitt
CSS Reference Manual:font-variant attribute
HTML DOM Reference Manual:font attribute
Instance
Example 1
Set the <p> element to small capitals font:
document.getElementById("myP").style.fontVariant = "small-caps";
Example 2
Return the font variant of the <p> element:
alert(document.getElementById("myP").style.fontVariant);
Syntax
Return fontVariant attribute:
object.style.fontVariant
Set fontVariant attribute:
object.style.fontVariant = "normal|small-caps|initial|inherit"
Attribute value
Value | Description |
---|---|
normal | The font is normal. Default. |
small-caps | The font is displayed in small capitals. |
initial | Set this property to its default value. See initial. |
inherit | Inherit this property from its parent element. See inherit. |
Technical details
Default value: | normal |
---|---|
Return value: | A string that represents the font for ordinary or small uppercase letters. |
CSS version: | CSS1 |
Webbläsarstöd
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Stöd | Stöd | Stöd | Stöd | Stöd |
- Föregående sida fontStyle
- Nästa sida fontWeight
- Gå tillbaka till föregående nivå HTML DOM Style Objekt