font-style Attribute | fontStyle Property

DHTML, HTML, & CSS

font-style Attribute | fontStyle Property


Sets or retrieves the font style of the object as italic, normal, or oblique.

Syntax

HTML{ font-style: sStyle }
Scriptingobject.style.fontStyle [ = sStyle ]

Possible Values

sStyle String that specifies one of the following values:
normalFont is normal.
italicFont is italic.
obliqueFont is italic.

The property is read/write with a default value of normal; the cascading style sheets (CSS) attribute is inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

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

Example

The following examples use the font-style attribute and the fontStyle property to change font characteristics.

This example uses H3 as a selector to set the font style to italic in H3 headings.

Sample Code

<STYLE>
    H3 { font-style:italic }
</STYLE>

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

This example uses inline scripting to set the font style to italic when an onmousedown event occurs.

<DIV onmousedown="this.style.fontStyle='italic'"> 

This feature requires Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, currentStyle, custom, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, Hn, HTML, I, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, runtimeStyle, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP

See Also

font


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.