Javascript examples for CSS Style Property:fontStyle
The fontStyle property sets or gets whether the style of the font is normal, italic or oblique.
Value | Description |
---|---|
normal | Font is normal. This is default |
italic | Font is in italic |
oblique | Font is in oblique |
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 the font style of the text in the element |
CSS Version | CSS1 |
Set the font for a <p> element to "italic":
<!DOCTYPE html> <html> <body> <p id="myP" style="font-style:italic;">This is a paragraph.</p> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() {//from ww w . java2 s . co m document.getElementById("myP").style.fontStyle = 'italic'; } </script> </body> </html>