Abakada: Back to Basics > Language References > CSS Properties > Font Properties > font-style Property
Sets or retrieves whether the object’s font style is italic, normal, or oblique.
CSS |
{ font-style: 'normal' | 'italic' | 'oblique' } |
Script |
object.style.fontStyle = sStyle ] |
normal |
Font is normal. |
italic |
Font is italicized. |
oblique |
Font is italicized. |
The property is read/write with a default value of normal; the cascading stylesheet ( CSS ) attribute is inherited.
The possible value oblique is available as of Microsoft® Internet Explorer® 4.0. Internet Explorer® 4.0 renders italic and oblique identically.
The following examples demonstrate use of inline event handlers to dynamically change an element’s font-style characteristics. Both methods yield the same effect.
The sample below defines a font-style attribute in an embedded stylesheet, and invokes calls to the stylesheet in response to mouse events.
<style>
.itals { font-style: italic }
</style>
...
<p onmouseover="this.className='itals'" onmouseout="this.className=''">
...
</p>
Show me
The sample below uses inline event handlers to dynamically set an object’s font style in response to mouse events.
<p onmousedown="this.style.fontStyle='italic'"
onmouseup="this.style.fontStyle=''">
...
</p>
Show me
font, @font-face Rule, font-family, font-size, font-variant, font-weight