fontfont*
*Contents  *Index  *Topic Contents
*Previous Topic: filter
*Next Topic: fontFamily

font

Description

Sets or retrieves the separate font attributes (fontWeight, fontVariant, fontSize, and fontFamily) for text in the element.

Syntax

object.style.font[ = font]

Remarks

Setting this property also sets the component properties. In this case, the string must be a combination of valid values for the component properties, with no more than one value per property. If the string does not contain a value for a component property, that property remains unchanged.

Example

The following JScript example sets the font to a 12-point, serif typeface with a normal weight and with all letters in small capital letters.

var sVar = document.all.MyParagraph;
sVar.style.font = "normal small-caps 12pt serif";
    .
    .
    .
alert(sVar.font.style);

Applies To

HTML Tags A, ADDRESS, APPLET, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, INPUT, INPUT type=button, INPUT type=file, INPUT type=reset, INPUT type=submit, INPUT type=text, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP
Scripting style

CSS Attribute

font


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.