Style fontVariant attribute
- Poprzednia strona fontStyle
- Następna strona fontWeight
- Wróć do poprzedniego poziomu Obiekt Style HTML DOM
Definition and usage
fontVariant
Property to set or return whether the font is displayed as small caps.
This means that all lowercase letters will be converted to uppercase, but these letters will be smaller in font size compared to the rest of the text.
See also:
CSS Tutorial:Czcionki CSS
CSS Reference Manual:font-variant attribute
HTML DOM Reference Manual:font property
Instance
Example 1
Sets the <p> element to small caps font:
document.getElementById("myP").style.fontVariant = "small-caps";
Example 2
Returns the font variant of the <p> element:
alert(document.getElementById("myP").style.fontVariant);
Syntax
Return fontVariant property:
object.style.fontVariant
Set fontVariant property:
object.style.fontVariant = "normal|small-caps|initial|inherit"
Attribute value
Value | Description |
---|---|
normal | Font is normal. Default. |
small-caps | Font displayed in small caps. |
initial | Sets this property to its default value. See initial. |
inherit | Inherits this property from its parent element. See inherit. |
Technical details
Default value: | normal |
---|---|
Return value: | String that represents the font style for normal or small caps. |
CSS version: | CSS1 |
Wsparcie przeglądarek
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Wspierane | Wspierane | Wspierane | Wspierane | Wspierane |
- Poprzednia strona fontStyle
- Następna strona fontWeight
- Wróć do poprzedniego poziomu Obiekt Style HTML DOM