Scholar Repository
Home>Manual>HTML DOM Style object

HTML DOM Style object

From http://www.w3schools.com (Copyright Refsnes Data)

HTML DOM Style Object


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:

IE: Internet Explorer, M: Mac IE only, W: Windows IE only, F: Firefox, O: Opera, W3C: World Wide Web Consortium (Internet Standard).

Background properties

Property Description IE F O W3C
background Sets all background properties in one 4 1 9 Yes
backgroundAttachment Sets whether a background-image is fixed or scrolls with the page 4 1 9 Yes
backgroundColor Sets the background-color of an element 4 1 9 Yes
backgroundImage Sets the background-image of an element 4 1 9 Yes
backgroundPosition Sets the starting position of a background-image 4 No No Yes
backgroundPositionX Sets the x-coordinates of the backgroundPosition property 4 No No No
backgroundPositionY Sets the y-coordinates of the backgroundPosition property 4 No No No
backgroundRepeat Sets if/how a background-image will be repeated 4 1 9 Yes

Border and Margin properties

Property Description IE F O W3C
border Sets all properties for the four borders in one 4 1 9 Yes
borderBottom Sets all properties for the bottom border in one 4 1 9 Yes
borderBottomColor Sets the color of the bottom border 4 1 9 Yes
borderBottomStyle Sets the style of the bottom border 4 1 9 Yes
borderBottomWidth Sets the width of the bottom border 4 1 9 Yes
borderColor Sets the color of all four borders (can have up to four colors) 4 1 9 Yes
borderLeft Sets all properties for the left border in one 4 1 9 Yes
borderLeftColor Sets the color of the left border 4 1 9 Yes
borderLeftStyle Sets the style of the left border 4 1 9 Yes
borderLeftWidth Sets the width of the left border 4 1 9 Yes
borderRight Sets all properties for the right border in one 4 1 9 Yes
borderRightColor Sets the color of the right border 4 1 9 Yes
borderRightStyle Sets the style of the right border 4 1 9 Yes
borderRightWidth Sets the width of the right border 4 1 9 Yes
borderStyle Sets the style of all four borders (can have up to four styles) 4 1 9 Yes
borderTop Sets all properties for the top border in one 4 1 9 Yes
borderTopColor Sets the color of the top border 4 1 9 Yes
borderTopStyle Sets the style of the top border 4 1 9 Yes
borderTopWidth Sets the width of the top border 4 1 9 Yes
borderWidth Sets the width of all four borders (can have up to four widths) 4 1 9 Yes
margin Sets the margins of an element (can have up to four values) 4 1 9 Yes
marginBottom Sets the bottom margin of an element 4 1 9 Yes
marginLeft Sets the left margin of an element 4 1 9 Yes
marginRight Sets the right margin of an element 4 1 9 Yes
marginTop Sets the top margin of an element 4 1 9 Yes
outline Sets all outline properties in one 5M 1 9 Yes
outlineColor Sets the color of the outline around an element 5M 1 9 Yes
outlineStyle Sets the style of the outline around an element 5M 1 9 Yes
outlineWidth Sets the width of the outline around an element 5M 1 9 Yes
padding Sets the padding of an element (can have up to four values) 4 1 9 Yes
paddingBottom Sets the bottom padding of an element 4 1 9 Yes
paddingLeft Sets the left padding of an element 4 1 9 Yes
paddingRight Sets the right padding of an element 4 1 9 Yes
paddingTop Sets the top padding of an element 4 1 9 Yes

Layout properties

Property Description IE F O W3C
clear Sets on which sides of an element other floating elements are not allowed 4 1 9 Yes
clip Sets the shape of an element 4 1 9 Yes
content Sets meta-information 5M 1   Yes
counterIncrement Sets a list of counter names, followed by an integer. The integer indicates by how much the counter is incremented for every occurrence of the element. The default is 1 5M 1   Yes
counterReset Sets a list of counter names, followed by an integer. The integer gives the value that the counter is set to on each occurrence of the element. The default is 0 5M 1   Yes
cssFloat Sets where an image or a text will appear (float) in another element 5M 1 9 Yes
cursor Sets the type of cursor to be displayed 4 1 9 Yes
direction Sets the text direction of an element 5 1 9 Yes
display Sets how an element will be displayed 4 1 9 Yes
height Sets the height of an element 4 1 9 Yes
markerOffset Sets the distance between the nearest border edges of a marker box and its principal box 5M 1   Yes
marks Sets whether cross marks or crop marks should be rendered just outside the page box edge 5M 1   Yes
maxHeight Sets the maximum height of an element 5M 1 9 Yes
maxWidth Sets the maximum width of an element 5M 1 9 Yes
minHeight Sets the minimum height of an element 5M 1 9 Yes
minWidth Sets the minimum width of an element 5M 1 9 Yes
overflow Specifies what to do with content that does not fit in an element box 4 1 9 Yes
verticalAlign Sets the vertical alignment of content in an element 4 1 No Yes
visibility Sets whether or not an element should be visible 4 1 9 Yes
width Sets the width of an element 4 1 9 Yes

List properties

Property Description IE F O W3C
listStyle Sets all the properties for a list in one 4 1 9 Yes
listStyleImage Sets an image as the list-item marker 4 1 No Yes
listStylePosition Positions the list-item marker 4 1 9 Yes
listStyleType Sets the list-item marker type 4 1 9 Yes

Misc properties

Property Description IE F O W3C
cssText   4 1    

Positioning properties

Property Description IE F O W3C
bottom Sets how far the bottom edge of an element is above/below the bottom edge of the parent element 5 1 9 Yes
left Sets how far the left edge of an element is to the right/left of the left edge of the parent element 4 1 9 Yes
position Places an element in a static, relative, absolute or fixed position 4 1 9 Yes
right Sets how far the right edge of an element is to the left/right of the right edge of the parent element 5 1 9 Yes
top Sets how far the top edge of an element is above/below the top edge of the parent element 4 1 9 Yes
zIndex Sets the stack order of an element 4 1 9 Yes

Printing properties

Property Description IE F O W3C
orphans Sets the minimum number of lines for a paragraph that must be left at the bottom of a page 5M 1 9 Yes
page Sets a page type to use when displaying an element 5M 1 9 Yes
pageBreakAfter Sets the page-breaking behavior after an element 4 1 9 Yes
pageBreakBefore Sets the page-breaking behavior before an element 4 1 9 Yes
pageBreakInside Sets the page-breaking behavior inside an element 5M 1 9 Yes
size Sets the orientation and size of a page   1 9 Yes
widows Sets the minimum number of lines for a paragraph that must be left at the top of a page 5M 1 9 Yes

Scrollbar properties (IE-only)

Property Description IE F O W3C
scrollbar3dLightColor Sets the color of the left and top sides of the arrows and scroll boxes 5W No No No
scrollbarArrowColor Sets the color of the arrows on a scroll bar 5W No No No
scrollbarBaseColor Sets the base color of the scroll bar 5W No No No
scrollbarDarkShadowColor Sets the color of the right and bottom sides of the arrows and scroll boxes 5W No No No
scrollbarFaceColor Sets the front color of the scroll bar 5W No No No
scrollbarHighlightColor Sets the color of the left and top sides of the arrows and scroll boxes, and the background of a scroll bar 5W No No No
scrollbarShadowColor Sets the color of the right and bottom sides of the arrows and scroll boxes 5W No No No
scrollbarTrackColor Sets the background color of a scroll bar 5W No No No

Table properties

Property Description IE F O W3C
borderCollapse Sets whether the table border are collapsed into a single border or detached as in standard HTML 5 1 9 Yes
borderSpacing Sets the distance that separates cell borders 5M 1 9 Yes
captionSide Sets the position of the table caption 5M No No Yes
emptyCells Sets whether or not to show empty cells in a table 5M 1 9 Yes
tableLayout Sets the algorithm used to display the table cells, rows, and columns 5 No No Yes

Text properties

Property Description IE F O W3C
color Sets the color of the text 4 1 9 Yes
font Sets all font properties in one 4 1 9 Yes
fontFamily Sets the font of an element 4 1 9 Yes
fontSize Sets the font-size of an element 4 1 9 Yes
fontSizeAdjust Sets/adjusts the size of a text 5M 1 No Yes
fontStretch Sets how to condense or stretch a font 5M No No Yes
fontStyle Sets the font-style of an element 4 1 9 Yes
fontVariant Displays text in a small-caps font 4 1 9 Yes
fontWeight Sets the boldness of the font 4 1 9 Yes
letterSpacing Sets the space between characters 4 1 9 Yes
lineHeight Sets the distance between lines 4 1 9 Yes
quotes Sets which quotation marks to use in a text 5M 1   Yes
textAlign Aligns the text 4 1 9 Yes
textDecoration Sets the decoration of a text 4 1 9 Yes
textIndent Indents the first line of text 4 1 9 Yes
textShadow Sets the shadow effect of a text 5M 1   Yes
textTransform Sets capitalization effect on a text 4 1 9 Yes
unicodeBidi   5 1   Yes
whiteSpace Sets how to handle line-breaks and white-space in a text 4 1 9 Yes
wordSpacing Sets the space between words in a text 6 1 9 Yes

Standard Properties

Property Description IE F O W3C
dir Sets or returns the direction of text 5 1 9 Yes
lang Sets or returns the language code for an element 5 1 9 Yes
title Sets or returns an element's advisory title 5 1 9 Yes



From http://www.w3schools.com (Copyright Refsnes Data)

Home>Manual>HTML DOM Style object