Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.arcetri.astro.it/irlab/doc/library/javascript/clientreference/style.htm
Дата изменения: Thu Oct 7 13:13:34 1999
Дата индексирования: Sat Dec 22 14:18:31 2007
Кодировка:

Поисковые слова: п п п п п
Table of Contents | Previous | Next | Index


Style

An object that specifies the style of HTML elements.

Client-side object

Implemented in

JavaScript 1.2

Created by

Any of the following properties or methods of the document object:

Description

The Style object lets you implement dynamic HTML style sheets in JavaScript. The methods and properties of the Style object implement the cascading style sheet style properties of HTML in JavaScript.

For a complete description of style sheets, see Dynamic HTML in Netscape Communicator.

Property Summary

Property Description
align

Specifies the alignment of an HTML element within its parent.

backgroundColor

Specifies a solid background color for an element.

backgroundImage

Specifies a background image for an HTML element.

borderBottomWidth

Specifies the width of the bottom border of an HTML element.

borderColor

Specifies the color of the border of an HTML element.

borderLeftWidth

Specifies the width of the left border of an HTML element.

borderRightWidth

Specifies the width of the right border of an HTML element.

borderStyle

Specifies the style of border, such as solid or double, around a block-level HTML element.

borderTopWidth

Specifies the width of the top border of an HTML element.

clear

Specifies the sides of an HTML element that allow floating elements.

color

Specifies the color of the text in an HTML element.

display

Overrides the usual display of an element and specifies whether the element appears in line, as a block-level element, or as a block-level list item.

fontFamily

Specifies the font family, such as Helvetica or Arial, for an HTML text element.

fontSize

Specifies the font size for an HTML text element.

fontStyle

Specifies the style of the font of an HTML element.

fontWeight

Specifies the weight of the font of an HTML element.

lineHeight

Specifies the distance between the baselines of two adjacent lines of block-level type.

listStyleType

Specifies the style of bullet displayed for list items.

marginBottom

Specifies the minimal distance between the bottom of an HTML element and the top of an adjacent element.

marginLeft

Specifies the minimal distance between the left side of an HTML element and the right side of an adjacent element.

marginRight

Specifies the minimal distance between the right side of an HTML element and the left side of an adjacent element.

marginTop

Specifies the minimal distance between the top of an HTML element and the bottom of an adjacent element.

paddingBottom

Specifies how much space to insert between the bottom of an element and its content, such as text or an image.

paddingLeft

Specifies how much space to insert between the left side of an element and its content, such as text or an image.

paddingRight

Specifies how much space to insert between the right side of an element and its content, such as text or an image.

paddingTop

Specifies how much space to insert between the top of an element and its content, such as text or an image.

textAlign

Specifies the alignment of an HTML block-level text element.

textDecoration

Specifies special effects, such as blinking, strike-outs, and underlines, added to an HTML text element.

textIndent

Specifies the length of indentation appearing before the first formatted line of a block-level HTML text element.

textTransform

Specifies the case of an HTML text element.

whiteSpace

Specifies whether or not white space within an HTML element should be collapsed.

width

Specifies the width of a block-level HTML element.

Method Summary

Method Description
borderWidths

Specifies the width of the borders of an HTML element.

margins

Specifies the minimal distance between the sides of an HTML element and the sides of adjacent elements.

paddings

Specifies how much space to insert between the sides of an element and its content, such as text or an image.

In addition, this object inherits the watch and unwatch methods from Object.


align

Specifies the alignment of an HTML element within its parent.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.align = {left | right | none}

Parameters

styleObject

A Style object.

Do not confuse align with textAlign, which specifies the alignment of the content of text elements.

The align property is a reflection of the cascading style sheet float property.


backgroundColor

Specifies a solid background color for an element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.backgroundColor = colorValue

Parameters

styleObject

A Style object.

colorValue

A string evaluating to a color value, as described in Appendix B, "Color Values."

The backgroundColor property is a reflection of the cascading style sheet background-color property.


backgroundImage

Specifies a background image for an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.backgroundImage = url

Parameters

styleObject

A Style object.

url

A string evaluating to either a full URL or a partial URL relative to the source of the style sheet.

The backgroundImage property is a reflection of the cascading style sheet background-image property.


borderBottomWidth

Specifies the width of the bottom border of an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.borderBottomWidth = length

Parameters

styleObject

A Style object.

length

A string evaluating to a size followed by a unit of measurement; for example, 10pt.

The borderBottomWidth property is a reflection of the cascading style sheet border-bottom-width property.

See also

Style.borderLeftWidth, Style.borderRightWidth, Style.borderTopWidth, Style.borderWidths


borderColor

Specifies the color of the border of an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.borderColor = {none | colorValue}

Parameters

styleObject

A Style object.

colorValue

A string evaluating to a color value, as described in Appendix B, "Color Values."

The borderColor property is a reflection of the cascading style sheet border-color property.


borderLeftWidth

Specifies the width of the left border of an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.borderLeftWidth = length

Parameters

styleObject

A Style object.

length

A string evaluating to a size followed by a unit of measurement; for example, 10pt.

The borderLeftWidth property is a reflection of the cascading style sheet border-left-width property.

See also

Style.borderBottomWidth, Style.borderRightWidth, Style.borderTopWidth, Style.borderWidths


borderRightWidth

Specifies the width of the right border of an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.borderRightWidth = length

Parameters

styleObject

A Style object.

length

A string evaluating to a size followed by a unit of measurement; for example, 10pt.

The borderRightWidth property is a reflection of the cascading style sheet border-right-width property.

See also

Style.borderBottomWidth, Style.borderLeftWidth, Style.borderTopWidth, Style.borderWidths


borderStyle

Specifies the style of border, such as solid or double, around a block-level HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.borderStyle = styleType

Parameters

styleObject

A Style object.

styleType

A string evaluating to any of the following keywords:

You must also specify a border width for the border to be visible.

The borderStyle property is a reflection of the cascading style sheet border-style property.


borderTopWidth

Specifies the width of the top border of an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.borderTopWidth = length

Parameters

styleObject

A Style object.

length

A string evaluating to a size followed by a unit of measurement; for example, 10pt.

The borderTopWidth property is a reflection of the cascading style sheet border-top-width property.

See also

Style.borderBottomWidth, Style.borderLeftWidth, Style.borderRightWidth, Style.borderWidths


borderWidths

Specifies the width of the borders of an HTML element.

Method of

Style

Implemented in

JavaScript 1.2

Syntax

borderWidths(top, right, bottom, left)

Parameters

top

A string specifying the value of the Style.borderTopWidth property.

right

A string specifying the value of the Style.borderRightWidth property.

bottom

A string specifying the value of the Style.borderBottomWidth property.

left

A string specifying the value of the Style.borderLeftWidth property.

Description

The borderWidths method is a convenience shortcut for setting all the border width properties.

See also

Style.borderBottomWidth, Style.borderLeftWidth, Style.borderRightWidth, Style.borderTopWidth


clear

Specifies the sides of an HTML element that allow floating elements.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.clear = {left | right | both | none}

Parameters

styleObject

A Style object.

The clear property is a reflection of the cascading style sheet clear property.


color

Specifies the color of the text in an HTML element.

Property of

Style

Implemented in

JavaScript 1.2

Syntax

styleObject.color = colorValue

Parameters

styleObject

A Style object.