asp.net.ph

Skip Navigation LinksAbakada: Back to Basics > Language References > CSS Properties > Font Properties > font-style Property

font-style Attribute | fontStyle Property


Sets or retrieves whether the object’s font style is italic, normal, or oblique.

Syntax

CSS { font-style: 'normal' | 'italic' | 'oblique' }
Script object.style.fontStyle = sStyle ]

Possible Values

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.

Remarks

The possible value oblique is available as of Microsoft® Internet Explorer® 4.0. Internet Explorer® 4.0 renders italic and oblique identically.

Example

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 

See Also

font, @font-face Rule, font-family, font-size, font-variant, font-weight



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note