HTML DOM Style object

## JavaScript Reference

Overview

## JavaScript Objects

JS Array JS Boolean JS Date JS Math JS Number JS String JS RegExp JS Global

## Browser Objects

Window Navigator Screen History Location

## HTML DOM Objects

DOM Document DOM Elements DOM Attributes DOM Events

## HTML Objects

DOM Anchor DOM Area DOM Base DOM Body DOM Button DOM Form DOM Frame/IFrame DOM Frameset DOM Image DOM Input Button DOM Input Checkbox DOM Input File DOM Input Hidden DOM Input Password DOM Input Radio DOM Input Reset DOM Input Submit DOM Input Text DOM Link DOM Meta DOM Object DOM Option DOM Select DOM Style DOM Table DOM td / th DOM tr DOM Textarea

# HTML DOM Style Object

« Previous
Next Reference »

## Style object

The Style object represents an individual style statement.

The Style object can be accessed from the document or from the elements to which that style is applied.

Syntax for using the Style object properties:

document.getElementById("id").style.property="value"

The Style object property categories:

- Background
- Border/Outline
- Generated Content
- List
- Misc

- Margin/Padding
- Positioning/Layout
- Printing
- Table
- Text

## Background properties

W3C: W3C Standard.

Property | Description | W3C
--- | --- | ---
background | Sets or returns all the background properties in one declaration | Yes
backgroundAttachment | Sets or returns whether a background-image is fixed or scrolls with the page | Yes
backgroundColor | Sets or returns the background-color of an element | Yes
backgroundImage | Sets or returns the background-image for an element | Yes
backgroundPosition | Sets or returns the starting position of a background-image | Yes
backgroundRepeat | Sets or returns how to repeat (tile) a background-image | Yes

## Border/Outline properties

Property | Description | W3C
--- | --- | ---
border | Sets or returns border-width, border-style, and border-color in one declaration | Yes
borderBottom | Sets or returns all the borderBottom* properties in one declaration | Yes
borderBottomColor | Sets or returns the color of the bottom border | Yes
borderBottomStyle | Sets or returns the style of the bottom border | Yes
borderBottomWidth | Sets or returns the width of the bottom border | Yes
borderColor | Sets or returns the color of an element's border (can have up to four values) | Yes
borderLeft | Sets or returns all the borderLeft* properties in one declaration | Yes
borderLeftColor | Sets or returns the color of the left border | Yes
borderLeftStyle | Sets or returns the style of the left border | Yes
borderLeftWidth | Sets or returns the width of the left border | Yes
borderRight | Sets or returns all the borderRight* properties in one declaration | Yes
borderRightColor | Sets or returns the color of the right border | Yes
borderRightStyle | Sets or returns the style of the right border | Yes
borderRightWidth | Sets or returns the width of the right border | Yes
borderStyle | Sets or returns the style of an element's border (can have up to four values) | Yes
borderTop | Sets or returns all the borderTop* properties in one declaration | Yes
borderTopColor | Sets or returns the color of the top border | Yes
borderTopStyle | Sets or returns the style of the top border | Yes
borderTopWidth | Sets or returns the width of the top border | Yes
borderWidth | Sets or returns the width of an element's border (can have up to four values) | Yes
outline | Sets or returns all the outline properties in one declaration | Yes
outlineColor | Sets or returns the color of the outline around a element | Yes
outlineStyle | Sets or returns the style of the outline around an element | Yes
outlineWidth | Sets or returns the width of the outline around an element | Yes

## Generated Content Properties

Property | Description | W3C
--- | --- | ---
content | Sets or returns the generated content before or after the element | Yes
counterIncrement | Sets or returns the list of counters and increment values | Yes
counterReset | Sets or returns the list of counters and their initial values | Yes

## List properties

Property | Description | W3C
--- | --- | ---
listStyle | Sets or returns list-style-image, list-style-position, and list-style-type in one declaration | Yes
listStyleImage | Sets or returns an image as the list-item marker | Yes
listStylePosition | Sets or returns the position of the list-item marker | Yes
listStyleType | Sets or returns the list-item marker type | Yes

## Margin/Padding properties

Property | Description | W3C
--- | --- | ---
margin | Sets or returns the margins of an element (can have up to four values) | Yes
marginBottom | Sets or returns the bottom margin of an element | Yes
marginLeft | Sets or returns the left margin of an element | Yes
marginRight | Sets or returns the right margin of an element | Yes
marginTop | Sets or returns the top margin of an element | Yes
padding | Sets or returns the padding of an element (can have up to four values) | Yes
paddingBottom | Sets or returns the bottom padding of an element | Yes
paddingLeft | Sets or returns the left padding of an element | Yes
paddingRight | Sets or returns the right padding of an element | Yes
paddingTop | Sets or returns the top padding of an element | Yes

## Misc properties

Property | Description | W3C
--- | --- | ---
cssText | Sets or returns the contents of a style declaration as a string | Yes

## Positioning/Layout properties

Property | Description | W3C
--- | --- | ---
bottom | Sets or returns the bottom position of a positioned element | Yes
clear | Sets or returns the position of the element relative to floating objects | Yes
clip | Sets or returns which part of a positioned element is visible | Yes
cssFloat | Sets or returns the horizontal alignment of an object | Yes
cursor | Sets or returns the type of cursor to display for the mouse pointer | Yes
display | Sets or returns an element's display type | Yes
height | Sets or returns the height of an element | Yes
left | Sets or returns the left position of a positioned element | Yes
maxHeight | Sets or returns the maximum height of an element | Yes
maxWidth | Sets or returns the maximum width of an element | Yes
minHeight | Sets or returns the minimum height of an element | Yes
minWidth | Sets or returns the minimum width of an element | Yes
overflow | Sets or returns what to do with content that renders outside the element box | Yes
position | Sets or returns the type of positioning method used for an element (static, relative, absolute or fixed) | Yes
right | Sets or returns the right position of a positioned element | Yes
top | Sets or returns the top position of a positioned element | Yes
verticalAlign | Sets or returns the vertical alignment of the content in an element | Yes
visibility | Sets or returns whether an element should be visible | Yes
width | Sets or returns the width of an element | Yes
zIndex | Sets or returns the stack order of a positioned element | Yes

## Printing properties

Property | Description | W3C
--- | --- | ---
orphans | Sets or returns the minimum number of lines for an element that must be visible at the bottom of a page | Yes
pageBreakAfter | Sets or returns the page-break behavior after an element | Yes
pageBreakBefore | Sets or returns the page-break behavior before an element | Yes
pageBreakInside | Sets or returns the page-break behavior inside an element | Yes
widows | Sets or returns the minimum number of lines for an element that must be visible at the top of a page | Yes

## Table properties

Property | Description | W3C
--- | --- | ---
borderCollapse | Sets or returns whether the table border should be collapsed into a single border, or not | Yes
borderSpacing | Sets or returns the space between cells in a table | Yes
captionSide | Sets or returns the position of the table caption | Yes
emptyCells | Sets or returns whether to show the border and background of empty cells, or not | Yes
tableLayout | Sets or returns the way to lay out table cells, rows, and columns | Yes

## Text properties

Property | Description | W3C
--- | --- | ---
color | Sets or returns the color of the text | Yes
direction | Sets or returns the text direction | Yes
font | Sets or returns font-style, font-variant, font-weight, font-size, line-height, and font-family in one declaration | Yes
fontFamily | Sets or returns the font face for text | Yes
fontSize | Sets or returns the font size of the text | Yes
fontSizeAdjust | Sets or returns the font aspect value | Yes
fontStyle | Sets or returns whether the style of the font is normal, italic or oblique | Yes
fontVariant | Sets or returns whether the font should be displayed in small capital letters | Yes
fontWeight | Sets or returns the boldness of the font | Yes
letterSpacing | Sets or returns the space between characters in a text | Yes
lineHeight | Sets or returns the distance between lines in a text | Yes
quotes | Sets or returns the type of quotation marks for embedded quotations | Yes
textAlign | Sets or returns the horizontal alignment of text | Yes
textDecoration | Sets or returns the decoration of a text | Yes
textIndent | Sets or returns the indentation of the first line of text | Yes
textShadow | Sets or returns the shadow effect of a text | Yes
textTransform | Sets or returns the case of a text | Yes
unicodeBidi | Sets or returns whether the text should be overridden to support multiple languages in the same document | Yes
whiteSpace | Sets or returns how to handle tabs, line breaks and whitespace in a text | Yes
wordSpacing | Sets or returns the spacing between words in a text | Yes

« Previous
Next Reference »

## Your suggestion:

Your E-mail (optional):

Page address:

Description:

Close [X]

## Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

## WEB HOSTING

Best Web Hosting UK Reseller Hosting Wow! $5 SSD Hosting

## WEB BUILDING

Download XML Editor
FREE Website BUILDER FREE Website Creator

## WEB RESOURCES

Web Statistics Web Validation

## SHARE THIS PAGE