Style fontVariant attribute
- Page ya kuzungumza fontStyle
- Page ya kuzingatia fontWeight
- Rejea kipande chao Kifungu cha Style cha HTML DOM
Definition and usage
fontVariant
Property sets or returns 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:CSS fonti
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 also initial. |
inherit | Inherits this property from its parent element. See also inherit. |
Technical details
Default value: | normal |
---|---|
Return value: | String that represents the font for regular or small caps. |
CSS Version: | CSS1 |
Msaada wa kifungu
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Msaada | Msaada | Msaada | Msaada | Msaada |
- Page ya kuzungumza fontStyle
- Page ya kuzingatia fontWeight
- Rejea kipande chao Kifungu cha Style cha HTML DOM