Javascript examples for CSS Style Property:fontVariant
The fontVariant property sets or gets whether the font should be displayed in small capital letters.
All lowercase letters will be converted to uppercase, but the letters will have a smaller font-size.
Value | Description |
---|---|
normal | The font is normal. This is default |
small-caps | The font is displayed in small capital letters |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | normal |
Return Value: | A String, representing a font in either normal or small capital letters |
CSS Version | CSS1 |
Set a <p> element to a small-caps font:
<!DOCTYPE html> <html> <body> <p id="myP" style="font-variant:small-caps">This is a paragraph.</p> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() {//from www . j a v a 2 s . c om document.getElementById("myP").style.fontVariant = 'normal'; } </script> </body> </html>