Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 25. Client-Side JavaScript Refer... > CSS2Properties: a set of CSS attribu...

CSS2Properties: a set of CSS attributes and their valuesDOM Level 2 CSS2: Object → CSS2Properties

Properties


String cssText

The textual representation of a set of style attributes and their values. The text is formated as in a CSS stylesheet, minus the element selector and the curly braces that surround the attributes and values. Setting this property to an illegal value throws a DOMException with a code of SYNTAX_ERR. Attempting to set this property when the CSS2Properties object is read-only throws a DOMException with a code of NO_MODIFICATION_ALLOWED_ERR.

In addition to the cssText property, a CSS2Properties object also has a property corresponding to each CSS attribute that the browser supports. These property names correspond closely to the CSS attribute names, with minor changes required to avoid syntax errors in JavaScript. Multiword attributes that contain hyphens, such as "font-family", are written without hyphens in JavaScript, and each word after the first is capitalized: fontFamily. Also, the "float" attribute conflicts with the reserved word float, so it translates to the property cssFloat.

The CSS2Properties property names corresponding to each attribute defined by the CSS2 specification are listed in the following table. Note, however, that some browsers do not support all CSS attributes and may not implement all of the listed properties. Since the properties correspond directly to CSS attributes, no individual documentation is given for each property. See a CSS reference, such as Cascading Style Sheets: The Definitive Guide by Eric A. Meyer (O'Reilly), for the meaning and legal values of each. All of the properties are strings. Setting any of these properties may throw the same exceptions as setting the cssText property:

azimuth background backgroundAttachment backgroundColor
backgroundImage backgroundPosition backgroundRepeat border
borderBottom borderBottomColor borderBottomStyle borderBottomWidth
borderCollapse borderColor borderLeft borderLeftColor
borderLeftStyle borderLeftWidth borderRight borderRightColor
borderRightStyle borderRightWidth borderSpacing borderStyle
borderTop borderTopColor borderTopStyle borderTopWidth
borderWidth bottom captionSide clear
clip color content counterIncrement
counterReset cssFloat cue cueAfter
cueBefore cursor direction display
elevation emptyCells font fontFamily
fontSize fontSizeAdjust fontStretch fontStyle
fontVariant fontWeight height left
letterSpacing lineHeight listStyle listStyleImage
listStylePosition listStyleType margin marginBottom
marginLeft marginRight marginTop markerOffset
marks maxHeight maxWidth minHeight
minWidth orphans outline outlineColor
outlineStyle outlineWidth overflow padding
paddingBottom paddingLeft paddingRight paddingTop
page pageBreakAfter pageBreakBefore pageBreakInside
pause pauseAfter pauseBefore pitch
pitchRange playDuring position quotes
richness right size speak
speakHeader speakNumeral speakPunctuation speechRate
stress tableLayout textAlign textDecoration
textIndent textShadow textTransform top
unicodeBidi verticalAlign visibility voiceFamily
volume whiteSpace widows width
wordSpacing zIndex



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial