stylestyle*
*Contents  *Index  *Topic Contents
*Previous Topic: STYLE
*Next Topic: styleSheet

style

Description

Represents the current settings of all possible inline styles for a given element.

Remarks

Inline styles are CSS style assignments that an author applies directly to individual HTML elements using the STYLE= attribute. You use the style object to examine these assignments and either make new assignments or change existing ones.

You can retrieve the style object by applying the style keyword to an element object. You retrieve the current setting for an inline style by applying the corresponding style property to the style object.

The style object does not give access to the style assignments in style sheets. To obtain information about styles in style sheets, you must use the styleSheets collection to gain access to the individual style sheets defined in the document.

Examples

The following example sets the typeface for text in the document body to "Verdana".

document.body.style.fontFamily = "Verdana"

The following example positions the given image at the top of the document.

var i = document.all.tags("IMG");
if (i.length>0) {
    if (i[0].style.position == "absolute")
        i[0].style.top = 0;
}

Properties

background, backgroundAttachment, backgroundColor, backgroundImage, backgroundPosition, backgroundPositionX, backgroundPositionY, backgroundRepeat, border, borderBottom, borderBottomColor, borderBottomStyle, borderBottomWidth, borderColor, borderLeft, borderLeftColor, borderLeftStyle, borderLeftWidth, borderRight, borderRightColor, borderRightStyle, borderRightWidth, borderStyle, borderTop, borderTopColor, borderTopStyle, borderTopWidth, borderWidth, clear, clip, color, cssText, cursor, display, filter, font, fontFamily, fontSize, fontStyle, fontVariant, fontWeight, height, left, letterSpacing, lineHeight, listStyle, listStyleImage, listStylePosition, listStyleType, margin, marginBottom, marginLeft, marginRight, marginTop, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, pageBreakAfter, pageBreakBefore, pixelHeight, pixelLeft, pixelTop, pixelWidth, posHeight, position, posLeft, posTop, posWidth, styleFloat, textAlign, textDecoration, textDecorationBlink, textDecorationLineThrough, textDecorationNone, textDecorationOverline, textDecorationUnderline, textIndent, textTransform, top, verticalAlign, visibility, width, zIndex

Methods

getAttribute, removeAttribute, setAttribute

Applies To

element object


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