Book HomeDynamic HTML: The Definitive ReferenceSearch this book

11.5. Alphabetical Attribute Reference

 
azimuthNN n/a IE n/a CSS 2

Inherited: Yes
Given a listener at the center of a circular sound space (like in a surround-sound-equipped theater), azimuth sets the horizontal angle of the source of the sound (for example, in a text-to-speech browser). See also the elevation attribute.

CSS Syntax

azimuth: angle | angleConstant || direction

Value

Up to two values (other than inherit). One represents the angle, clockwise from straight ahead; the second is a 20-degree incremental movement to the left or right. An angle value is any value in the range of -360 to +360 (inclusive) plus the letters "deg", as in 90deg. The value 0deg is directly in front of the listener. To set the angle to the left of the listener, the value can be either -90deg or 270deg. Optionally, you can choose an angleConstant value from a large library of descriptions that correspond to fixed points around the circle. If you add the behind modifier, the values shift from in front of the listener to behind the listener.

Value

Equals

Value

Equals

center 0deg center behind 180deg
center-right 20deg center-right behind 160deg
right 40deg right behind 140deg
far-right 60deg far-right behind 120deg
right-side 90deg right-side behind 90deg
left-side 270deg left-side behind 270deg
far-left 300deg far-left behind 240deg
left 320deg left behind 220deg
center-left 340deg center-left behind 200deg

For the direction value, you can choose from two constants: leftwards | rightwards. These settings shift the sound 20 degrees in the named direction.

Initial Value

center

Example

h1 {azimuth: 45deg}
p.aside {azimuth: center-right behind}

Applies To

All elements.

 
backgroundNN 6 IE 4 CSS 1

Inherited: No
This is a shortcut attribute that lets you set up to five separate (but related) background-style attributes in one attribute statement. Values can be in any order, each one delimited by a space. Although the attribute is not officially available in Navigator 4, some combinations of values may work with it.

CSS Syntax

background: background-attachment || background-color || background-image || 
background-position || background-repeat

Value

Any combination of the five background-style attribute values, in any order. Any attribute not specified is assigned its initial value. See each attribute for details about the expected values.

Initial Value

None.

Example

body {background: url(watermark.jpg) repeat fixed}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.background
 
background-attachmentNN 6 IE 4 CSS 1

Inherited: No
When an image is applied to the element background (with the background-image attribute), the background-attachment attribute sets whether the image scrolls with the document. The image can remain fixed within the viewable area of the element (the viewport), or it may scroll with the element as content scrolls. During scrolling, a fixed attachment looks like a stationary backdrop to rolling credits of a movie.

CSS Syntax

background-attachment: fixed | scroll

Value

The fixed value keeps the image stationary in the element viewport; the scroll value lets the image scroll with the document content.

Initial Value

scroll

Example

body {background-attachment: fixed}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.backgroundAttachment
 
background-colorNN 4 IE 4 CSS 1

Inherited: No
Sets the background color for the element. Although it may appear as though a nested element's background-color attribute is inherited, in truth the initial value is transparent, which lets the next-outermost colored element show through whitespace of the current element.

CSS Syntax

background-color: color

Value

Any valid color specification (see description at beginning of the chapter) or transparent.

Initial Value

transparent

Example

.highlighter {background-color: yellow}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.backgroundColor
 
background-imageNN 4 IE 4 CSS 1

Inherited: No
Sets the background image (if any) for the element. If you set a background-color for the element as well, the color appears if the image fails to load; otherwise, the image overlays the color. Transparent pixels of the image allow a background color to show through. See also the background-attachment attribute.

CSS Syntax

background-image: uri | none

Value

To specify a URL, use the url( ) wrapper for the attribute value. You can omit the attribute or specify none to prevent an image from loading into the element's background.

Initial Value

none

Example

h1 {background-image: url(watermark.jpg)}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.backgroundImage
 
background-positionNN 6 IE 4 CSS 1

Inherited: No
Establishes the location of the left and top edges of the background image specified with the background-image attribute. The behavior of this attribute can be erratic in Internet Explorer 4 for the Macintosh.

CSS Syntax

background-position: [percentage | length] {1,2} | 
  [top | center | bottom] || [left | center | right]

Value

You can specify one or two percentages, which are the percentage of the block-level element's box width and height (respectively) at which the image (or repeated images) begins. If you supply only one percentage value, it applies to the horizontal measure, and the vertical measure is automatically set to 50%. Instead of percentages, you can specify length values (in the unit of measure that best suits the medium). You can also mix a percentage with a length. In lieu of the numerical values, you can create combinations of values with the two sets of constant values. Select one from each collection, as in top left, top right, or bottom center. Whenever you specify two values, they must be separated by a space.

Initial Value

0% 0%

Example

div.marked {background-image: url(watermark.jpg); 
    background-position: center top}

Applies To

Block-level and replaced elements.

Object Model Reference

[window.]document.getElementById("elementID").style.backgroundPosition
 
background-position-x, background-position-yNN n/a IE 4 CSS n/a

Inherited: No
Establish the location of the left (x) or top (y) edges of the background image specified with the background-image attribute.

CSS Syntax

background-position-x: [percentage | length] | [left | center | right ]
background-position-y: [percentage | length] | [top | center | bottom]

Value

You can specify the percentage of the block-level element's box width or height (respectively) at which the image (or repeated images) begins. Instead of percentages, you can specify length values (in the unit of measure that best suits the medium). In lieu of the numerical values, you may use one axis-specific constant value per attribute.

Initial Value

0%

Example

div.marked {background-image: url(watermark.jpg); 
    background-position-x: center}

Applies To

Block-level and replaced elements.

Object Model Reference

[window.]document.getElementById("elementID").style.backgroundPositionX
[window.]document.getElementById("elementID").style.backgroundPositionY
 
background-repeatNN 6 IE 4 CSS 1

Inherited: No
Sets whether a background image (specified with the background-image attribute) should repeat and, if so, along which axis. You can use repeating background images to create horizontal and vertical bands.

CSS Syntax

background-repeat: no-repeat | repeat | repeat-x | repeat-y

Value

With a setting of no-repeat, one instance of the image appears in the location within the element established by the background-position attribute (default is the top-left corner). Normal repeats are performed along both axes, but you can have the image repeat down a single column (repeat-y) or across a single row (repeat-x).

Initial Value

repeat

Example

body {background-image: url(icon.gif); background-repeat: repeat-y}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.backgroundRepeat
 
behaviorNN n/a IE 5(Win) CSS n/a

Inherited: No
Associates an external behavior definition to the element.

CSS Syntax

behavior: uri[, uri[, ...]]

Value

CSS-formatted URL value, with the actual URL pointing to an external .htc file, ID of an object element that loads a behavior ActiveX control into the page, or one of the built-in default behaviors (in the format url(#default#behaviorName)). Default behavior names are:

 

anchorClick

anim

clientCaps

download

homePage

httpFolder

mediaBar

saveFavorite

saveHistory

saveSnapshot

userData

 
 

For details on what these default behaviors do and under what security conditions you can use them, visit http://msdn.microsoft.com/workshop/author/behaviors/reference/reference.asp.

 

Initial Value

   

None.

 

Example

  input.numOnly {behavior: url(numInput.htc)}    

Applies To

   

All elements.

 

Object Model Reference

 
[window.]document.getElementById("elementID").style.behavior
[window.]document.getElementById("elementID").behaviorUrns[i]
 
 
 
borderNN 6 IE 4 CSS 1

Inherited: No
This is a shorthand attribute for setting the width, style, and/or color of all four borders around an element in one assignment statement. Whichever attributes you don't explicitly set with this attribute assume their initial values. Numerous other attributes allow you to set the width, style, and color of individual edges or groups of edges, if you don't want all four edges to be the same.

Due to differences in the way browsers define their default behavior with regard to borders, every style sheet border rule should include the width and style settings. Failure to specify both attributes may result in the border not being seen in one browser or the other.

CSS Syntax

border: border-width || border-style || color

Value

For the border-width and border-style attribute values, see the respective attributes in this chapter. For details on the color value, see the section about colors at the beginning of this chapter.

Initial Value

None.

Example

p {border: 3px groove darkred}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.border
 
border-bottom, border-left, border-right, border-topNN 6 IE 4 CSS 1

Inherited: No
All four attributes are shorthand attributes for setting the width, style, and/or color of a single border edge of an element in one assignment statement. Whichever attributes you don't explicitly set with this attribute assume their initial values.

CSS Syntax

border-bottom: border-bottom-width || border-bottom-style || color
border-left: border-left-width || border-left-style || color
border-right: border-right-width || border-right-style || color
border-top: border-top-width || border-top-style || color

Value

For the width and style attribute values, see the border-bottom-width and border-bottom-style attributes in this chapter. For details on the color value, see the section about colors at the beginning of this chapter.

Initial Value

None.

Example

p {border-bottom: 3px solid lightgreen}
p {border-left: 6px solid lightgreen}
p {border-right: 3px solid lightgreen}
p {border-top: 6px solid lightgreen}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.borderBottom
[window.]document.getElementById("elementID").style.borderLeft
[window.]document.getElementById("elementID").style.borderRight
[window.]document.getElementById("elementID").style.borderTop
 
border-bottom-color, border-left-color, border-right-color, border-top-colorNN 6 IE 4 CSS 2

Inherited: No
Each attribute sets the color of a single border edge of an element. This power is easy to abuse by mixing colors that don't belong together. See also the border-color attribute for setting the color of multiple edges in one statement.

CSS Syntax

border-bottom-color: color
border-left-color: color
border-right-color: color
border-top-color: color

Value

For details on the color value, see the section about colors at the beginning of this chapter.

Initial Value

None.

Example

p {border-bottom-color: gray}
div {border-left-color: #33c088}
p.special {border-right-color: rgb(150, 75, 0)}
h3 {border-top-color: rgb(100%, 50%, 21%)}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.borderBottomColor
[window.]document.getElementById("elementID").style.borderLeftColor
[window.]document.getElementById("elementID").style.borderRightColor
[window.]document.getElementById("elementID").style.borderTopColor
 
border-bottom-style, border-left-style, border-right-style, border-top-styleNN 6 IE 4 CSS 2

Inherited: No
Each attribute sets the line style of a single border edge of an element. The edge-specific attributes let you override a style that has been applied to all four edges with the border or border-style attributes, but the edge-specific setting must come after the other one (in source code order) in the style sheet rule. See also the border-style attribute for setting the style of multiple edges in one statement.

CSS Syntax

border-bottom-style: style
border-left-style: style
border-right-style: style
border-top-style: style

Value

Style values are constants that are associated with specific ways of rendering border lines. Not all browser versions recognize all of the values in the CSS recommendation. Style support is shown in the following table.

Value

NN

IE/Windows

IE/Mac

CSS

dashed

6

5.5

4

1

dotted

6

5.5

4

1

double

4

4

4

1

groove

4

4

4

1

hidden

6

n/a

4

2

inset

4

4

4

1

none

4

4

4

1

outset

4

4

4

1

ridge

4

4

4

1

solid

4

4

4

1

The manner that browsers interpret the definitions of the style values is not universal. Figure 11-1 shows a gallery of all styles as rendered by Internet Explorer 6 for Windows, Explorer 5 for Macintosh, and Netscape 6. Don't expect the same look in all browsers.

Figure 11-1

Figure 11-1. Border-style gallery

Initial Value

none

Example

p {border-style: solid; border-bottom-style: none}
div {border-left-style: ridge}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.borderBottomStyle
[window.]document.getElementById("elementID").style.borderLeftStyle
[window.]document.getElementById("elementID").style.borderRightStyle
[window.]document.getElementById("elementID").style.borderTopStyle
 
border-bottom-width, border-left-width, border-right-width, border-top-widthNN 4 IE 4 CSS 1

Inherited: No
Each attribute sets the width of a single border edge of an element. Note that Navigator 4's initial value is zero, which means that you must set the width for all border attribute settings if you expect to see the border in that browser. See also the border-width attribute for setting the width of multiple edges in one statement.

CSS Syntax

border-bottom-width: thin | medium | thick | length
border-left-width: thin | medium | thick | length
border-right-width: thin | medium | thick | length
border-top-width: thin | medium | thick | length

Value

Three constants—thin | medium | thick—allow the browser to define how many pixels are used to show the border. For more precision, you can also assign a length value (see the discussion of length values at the beginning of this chapter).

Initial Value

medium (NN 6, IE); 0 (NN 4).

Example

h2 {border-bottom-width: 2px}
div {border-left-width: thin}
p.special {border-right-width: 0.5em}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.borderBottomWidth
[window.]document.getElementById("elementID").style.borderLeftWidth
[window.]document.getElementById("elementID").style.borderRightWidth
[window.]document.getElementById("elementID").style.borderTopWidth
 
border-collapseNN 6 IE 5(Win) CSS 2

Inherited: Yes
Sets whether borders of adjacent table elements (cells, row groups, column groups) are rendered separately or collapsed (merged) to ignore any padding or margins between adjacent borders. A table set to the separate border model may also have its border-spacing and empty-cells style attributes set (if supported by the target browsers).

CSS Syntax

border-collapse: collapse | separate

Value

Constant values: collapse | separate.

Initial Value

separate

Applies To

The table element.

 
border-colorNN 4 IE 4 CSS 1

Inherited: No
This is a shortcut attribute that lets you set multiple border edges to the same or different colors. Navigator 4 allows only a single value, which applies to all four edges. For Internet Explorer and Netscape 6, you may supply one to four space-delimited color values. The number of values determines which sides receive the assigned colors.

CSS Syntax

border-color: color {1,4}

Value

For Navigator 4, one color value only. In Internet Explorer and Netscape 6, this attribute accepts one, two, three, or four color values, depending on how many and which borders you want to set with specific colors. Value quantities and positions are interpreted as shown in the following table.

Number of values

Effect

1

All four borders set to value

2

Top and bottom borders set to the first value, right and left borders set to the second value

3

Top border set to first value, right and left borders set to second value, bottom border set to third value

4

Top, right, bottom, and left borders set, respectively

Initial Value

The element's color style property (which is inherited if not specifically assigned for the element).

Example

h2 {border-color: red blue red}
div {border-color: red rgb(0,0,255) red}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.borderColor
 
border-spacingNN 6 IE n/a CSS 2

Inherited: Yes
Determines the size of the space (if any) between all cell borders in a table. This attribute requires that the border-collapse attribute be set to separate (which is typically the default value). If you include only one length value, it applies to both the horizontal and vertical cell spacing; for two values, the first applies to the horizontal and the second to the vertical. See
Figure 11-2 for a synopsis of a table's numerous dimension definitions.

Figure 11-2

Figure 11-2. The geometry of a table element

CSS Syntax

border-spacing: length[length]

Value

See the discussion of length values at the beginning of this chapter. If you want no spacing along one axis, set its value to zero.

Initial Value

0

Applies To

The table element.

 
border-styleNN 4 IE 4 CSS 1

Inherited: No
This is a shortcut attribute that lets you set multiple border edges to the same or different style. Navigator 4 allows only a single value, which applies to all four edges. For Internet Explorer and Netscape 6, you may supply one to four space-delimited border style values. The number of values determines which sides receive the assigned style.

CSS Syntax

border-style: borderStyle {1,4}

Value

Style values are constants that are associated with specific ways of rendering border lines. Not all browsers recognize all of the values in the CSS recommendation. Style support is as follows.

Value

NN

IE/Windows

IE/Mac

CSS

dashed

6

5.5

4

1

dotted

6

5.5

4

1

double

4

4

4

1

groove

4

4

4

1

hidden

6

n/a

4

2

inset

4

4

4

1

none

4

4

4

1

outset

4

4

4

1

ridge

4

4

4

1

solid

4

4

4

1

The precise manner in which browsers interpret the definitions of the style values is far from universal. Figure 11-1 shows a gallery of all styles as rendered by Internet Explorer 6 for Windows, Explorer 5 for Macintosh, and Netscape 6. Do not expect the exact same look in all browsers.

For Navigator 4, you may apply one style value only. In Internet Explorer and Netscape 6, this attribute accepts one, two, three, or four space-delimited borderStyle values, depending on how many and which borders you want to set with specific styles. Value quantities and positions are interpreted as shown in the following table.

Number of values

Effect

1

All four borders set to value

2

Top and bottom borders set to the first value, right and left borders set to the second value

3

Top border set to first value, right and left borders set to second value, bottom border set to third value

4

Top, right, bottom, and left borders set, respectively

Initial Value

none

Example

h1 {border-style: ridge; border-width: 3px}
div {border-style: solid double; border-width: 4px}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.borderStyle
 
border-widthNN 4 IE 4 CSS 1

Inherited: No
This is a shortcut attribute that lets you set multiple border edges to the same or different widths. You may supply one to four space-delimited width length values. The number of values determines which sides receive the assigned widths.

CSS Syntax

border-width: thin | medium | thick | length {1,4}

Value

Three constants—thin | medium | thick—allow the browser to define how many pixels are used to show the border. For more precision, you can also assign a length value (see the discussion of length values at the beginning of this chapter).

This attribute accepts one, two, three, or four space-delimited borderWidth values, depending on how many and which borders you want to set with specific styles. Value quantities and positions are interpreted as follows.

Number of values

Effect

1

All four borders set to value

2

Top and bottom borders set to the first value, right and left borders set to the second value

3

Top border set to first value, right and left borders set to second value, bottom border set to third value

4

Top, right, bottom, and left borders set, respectively

Initial Value

medium (IE and NN 6); 0 (NN 4)

Example

h1 {border-style: ridge; border-width: 3px 5px 3px}
div {border-style: solid double; border-width: 4px}

Applies To

All elements, but only block and replaced elements in IE 4 and 5 for Windows.

Object Model Reference

[window.]document.getElementById("elementID").style.borderWidth
 
bottomNN 6 IE 5 CSS 2

Inherited: No
The CSS specification calls for this attribute to define the position of the bottom edge of a positioned element's content (exclusive of borders and margins) relative to the bottom edge of the next outermost block content container. Of mainstream browsers, only IE 5 for Macintosh behaves this way. IE for Windows and Netscape 6 do something unexpected when the positioned element uses the root positioning context: instead of using the bottom of the document as the comparative edge, these browsers use the bottom of the browser window space (the viewport in CSS terminology). As a result, the precise bottom position of the element varies with the user's browser window size. This discrepancy makes it more practical to use the bottom property for a positioned element nested inside another positioned element. When the element is relative-positioned, the offset is based on the bottom edge of the inline location of where the element would normally appear in the content.

CSS Syntax

bottom: length | percentage | auto

Value

See the discussion about length values at the beginning of this chapter. Negative lengths may be allowed in some contexts, but be sure to test the results on all browsers. You may also specify a percentage value, which is calculated based on the height of the next outermost container. The setting of auto lets the browser determine the bottom offset of the element box on its naturally flowing offset within the containing box.

Initial Value

auto

Applies To

All positioned elements.

Object Model Reference

[window.]document.getElementById("elementID").style.bottom
 
caption-sideNN 6 IE 5(Mac) CSS 2

Inherited: Yes
Positions the caption element above or below the tabular content of the enclosing table element (other values may not work in some browsers). This attribute supplants some deprecated align attribute settings of the caption element.

CSS Syntax

caption-side: top | bottom | left | right

Value

One of the four constant values: top | bottom | left | right.

Initial Value

top

Applies To

caption elements.

Object Model Reference

[window.]document.getElementById("elementID").style.captionSide
 
clearNN 4 IE 4 CSS 1

Inherited: No
Defines whether a block-level element allows itself to be displayed in the same horizontal band as a nearby floating element, such as an image. Typically, another element in the vicinity has its float style attribute set to left or right. To prevent the current element from being in the same band as the floating block, set the clear attribute to the same side (left or right). If you aren't sure where the potential overlap might occur, set the clear attribute to both. An element with a clear attribute that is set to a value other than none is rendered at the beginning of the next available line below the floating element.

CSS Syntax

clear: both | left | none | right

Value

Any of the following constants: both | left | none | right.

Initial Value

none

Example

<img src="logo.gif" height="40" width="60" style="float: right">
<h1 style="clear: right">Giantco Corporation</h1>

Applies To

Block-level elements.

Object Model Reference

[window.]document.getElementById("elementID").style.clear
 
clipNN 4 IE 4 CSS 2

Inherited: No
Defines a clipping region of a positionable element. The clipping region is the area of the element layer in which content is visible. For the best results in clipping content, wrap the content-holding element inside a div element with its clip attribute set to the desired region. Clipping may not work properly in Internet Explorer 4 for the Macintosh, but it is fine in Version 5. Also, when a clipped element is displayed at the very bottom of a page in Navigator 4, the browser window may not allow you to scroll to view the very bottom of the clipping region.

CSS Syntax

clip: rect(lengthTop lengthRight lengthBottom lengthLeft) | auto

Value

Extending to CSS2, the only shape recognized for the clip attribute is rect. Other shapes may be admitted in the future.

When specifying lengths for each side of the clipping rectangle, observe the clockwise order of values: top, right, bottom, left. See the discussion about length values at the beginning of this chapter. A value of auto sets the clipping region to the block that contains the content (a block that may extend in IE 4 to the width of the next outermost container, like the body element).

Initial Value

auto

Example

<span style="position: absolute; clip: rect(10px 110px 80px 10px)">
<img src="desk1.gif" height="90" width="120">
</span>

Applies To

Block-level, replaced, and positioned elements.

Object Model Reference

[window.]document.getElementById("elementID").style.clip
 
colorNN 4 IE 4 CSS 1

Inherited: Yes
Defines the foreground text color of the element. For some graphically oriented elements, such as form controls, the color attribute may also be applied to element edges or other features. Such extracurricular behavior is browser-specific and may not be the same across browsers.

CSS Syntax

color: color

Value

See the discussion of color attribute values at the beginning of this chapter.

Initial Value

black

Example

th {color: darkred}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.color
 
contentNN 6 IE n/a CSS 2

Inherited: No
Defines the actual content or source of content to be displayed before and/or after the current element. In CSS jargon, this kind of content is called generated content. This attribute may be set only with the :before and :after pseudo-elements associated with a real element. For example, as a result of the following style sheet rule:

blockquote:after {content:"(Reprinted by permission.)"}

a permissions phrase is appended to the end of every blockquote element, although the content does not become a member of the document tree. HTML tags in the content text are not interpreted, but if the situation warrants it, an external document can be assigned to the content attribute.

CSS Syntax

content: string | uri | counter | attr(attrName) | open-quote | close-quote |
no-open-quote | no-close-quote

Value

Only the following value types or values are functional in Netcape 6: string, open-quote, close-quote, no-open-quote, and no-close-quote. The purpose of the "no" quote types is to let you specify the effect of a quote (as far as quote nesting goes) without displaying a quote symbol. Multiple space-delimited strings may follow the content: attribute name.

Another value (counter) is not yet supported by browsers, but its potential is significant for documents that would benefit from client-side section number generation. A CSS counter offers a way for a style sheet to control numbering schemes for sequences of elements (such as sections, illustrations, and the like). The assumption is that the numbering is not part of the actual content, but is determined solely by the rendered context of the element within the document. Therefore, if you remove a numbered paragraph from a document in the edit phase, the paragraph numbering of the document adjusts itself automatically when the page is rendered.

The basic operation of a counter entails assigning an identifier to it (thus allowing multiple counters to exist in the same document, such as one for sections, another for subsections). Other CSS attributes (counter-increment and counter-reset) require values that point to an identified counter to control the numbering sequence. The following style sheet rule inserts a section label and number in front of every h1 element, and increments the counter number each time the style is applied to an h1 element while the document renders:

h1:before {counter-increment:secNum; 
           content:"Section " counter(secNum) ". "}

When counters are implemented in mainstream browsers, they will provide substantial power to highly structured, long documents.

Initial Value

"" (empty string)

Example

p.note:before {content:"==>"}

Applies To

All elements plus a :before and/or :after pseudo-element.

 
counter-increment, counter-resetNN n/a IE n/a CSS 2

Inherited: No
These attributes control the numbering sequence of a CSS counter used for generated content (see the content attribute). The counter-increment attribute sets the amount (and direction) of change each time the counter is accessed during rendering. The counter-reset attribute lets you set the counter to a specific number (default of zero).

CSS Syntax

counter-increment: counterID [ posOrNegInteger ] | none
counter-reset: counterID [ posOrNegInteger ] | none

Value

A counterID is an identifier assigned to a content:counter(counterID) style attribute. The optional integer value is space-delimited after the counterID. You can combine multiple counter IDs in the same style attribute by stringing together space-delimited pairs of ID and integer values.

Initial Value

none

Example

h1 {counter-reset:subSection}

Applies To

All elements.

 
cueNN n/a IE n/a CSS 2

Inherited: No
For aural style sheets only, this attribute provides a shorthand for setting cue-before and cue-after attribute settings. A cue is a sound (also known as an auditory icon) that can be used to aurally delimit the reading of document content. Cue attributes are URIs to sound resources.

CSS Syntax

cue: cue-before || cue-after

Value

If there are two values, the first is applied to the cue-before attribute and the second to the cue-after attribute. If there is only one value, the same auditory icon is applied to both cue-before and cue-after.

Initial Value

none

Applies To

All elements.

 
cue-after, cue-beforeNN n/a IE n/a CSS 2

Inherited: No
For aural style sheets only, a cue is a sound (also known as an auditory icon) that can be used to aurally delimit the reading of document content. The cue-before and cue-after attributes are URIs to sound files that are to be played before and after the content is rendered via text-to-speech or other aural medium.

CSS Syntax

cue-after: uri | none
cue-before: uri | none

Value

Any valid complete or relative URL (in CSS format) to a sound file in a MIME type supported by the browser. You may apply the same values to both attributes for the same style selector if it makes aural sense for the listener.

Initial Value

none

Example

li {cue-before: url(ding.wav); cue-after: url(dong.wav)}

Applies To

All elements.

 
cursorNN 6 IE 4 CSS 2

Inherited: Yes
Sets the shape of the cursor when the screen pointer is atop the element. The precise look of cursors depends on the operating system. Before deploying a modified cursor, be sure you understand the standard ways that the various types of cursors are used within the browser and operating system. Users expect a cursor design to mean the same thing across all applications.
Figure 11-3 offers a gallery of cursors for each of the cursor constant settings provided by Internet Explorer for Windows.

Figure 11-3

Figure 11-3. Internet Explorer cursor gallery

CSS Syntax

cursor: cursorType || uri

Value

A cursor type is one of the implemented cursor names. The following table shows which cursor types are supported by various browsers and the CSS standard.

Cursor name

IE/Windows

IE/Mac

NN

CSS

alias

n/a

n/a

6

n/a

all-scroll

6

n/a

n/a

n/a

auto

4

4

6

2

cell

n/a

n/a

6

n/a

col-resize

6

n/a

n/a

n/a

context-menu

n/a

n/a

6

n/a

copy

n/a

n/a

6

n/a

count-down

n/a

n/a

6

n/a

count-up

n/a

n/a

6

n/a

count-up-down

n/a

n/a

6

n/a

crosshair

4

4

6

2

default

4

4

6

2

e-resize

4

4

6

2

grab

n/a

n/a

6

n/a

grabbing

n/a

n/a

6

n/a

hand

4

4

n/a

n/a

help

4

4

6

2

move

4

4

6

2

n-resize

4

4

6

2

ne-resize

4

4

6

2

no-drop

6

n/a

n/a

n/a

not-allowed

6

n/a

n/a

n/a

nw-resize

4

4

6

2

pointer

4

4

6

2

progress

6

n/a

n/a

n/a

row-resize

6

n/a

n/a

n/a

s-resize

4

4

6

2

se-resize

4

4

6

2

spinning

n/a

n/a

6

n/a

sw-resize

4

4

6

2

text

4

4

6

2

url(uri)

6

n/a

n/a

2

vertical-text

6

n/a

n/a

n/a

w-resize

4

4

6

2

wait

4

4

6

2

Notice that IE 6 for Windows implements downloadable cursors. The IE 6 setting for an external URL requires an address of a cursor file of extension .cur or .ani (which you create with a graphics utility that creates Windows cursors).

Initial Value

auto

Example

a.helpLink {cursor: help}

Applies To

All elements.

 
directionNN 6 IE 5 CSS 2

Inherited: Yes
Sets the direction of the flow of inline portions of content (such as text) and the order in which table cells are filled along a row. Analogous to the dir attribute of most elements, the direction style attribute lets you override the browser's default rendering direction for other languages or special content.

CSS Syntax

direction: ltr | rtl

Value

Either of two directional constants. The value ltr stands for left-to-right; rtl stands for right-to-left.

Initial Value

ltr

Applies To

All elements.

 
displayNN 4 IE 4 CSS 1

Inherited: No
This is a multipurpose attribute that determines how a browser treats invisible boxes that surround every element and text node. For example, a block-level item exhibits specific characteristics that are quite distinct from an inline item (at least with respect to how the element renders in relation to surrounding content). The CSS specification provides numerous types of such boxes, because the space they occupy can be influenced differently by such things as borders or even outright rendering rules (e.g., the way a compact style controls definition list items). In practice, you may not see much, if any, difference between some display types because the browser's built-in style sheet doesn't specify anything different for the variations (e.g., a table element may render the same way if its display style attribute is set to block or table). At the same time, the display style lets you override the default rendering behavior of elements, such as making a block table render as an inline table.

Perhaps the most frequently used aspect of the display style attribute in DHTML is setting the scripts to toggle between showing and completely hiding the element and its space. When the attribute is set to none, the element is hidden from view, and all surrounding content cinches up to occupy whatever space the element would normally occupy. This is different from the visibility attribute, which reserves space for the element while hiding it from view. But to redisplay the item to its default display mode, you can assign one of the common display types (block and inline) or the more specific type associated with the element (such as list-item for an li element), if supported by your target browsers.

CSS Syntax

display: displayType

Value

The CSS specification identifies many display types, but browser support is more limited. The following table shows the supported types.

Display type

IE/Windows

IE/Mac

NN

CSS

block

5

4

6

2

compact

n/a

n/a

n/a

2

inline

5

4

6

2

inline-block

5.5

n/a

n/a

n/a

inline-table

n/a

5

n/a

2

list-item

5

5

6

2

marker

n/a

n/a

n/a

2

none

4

4

6

2

run-in

n/a

5

n/a

2

table

n/a

5

6

2

table-caption

n/a

5

n/a

2

table-cell

n/a

5

6

2

table-column-group

n/a

5

n/a

2

table-footer-group

5.5

5

6

2

table-header-group

5

5

6

2

table-row

n/a

5

6

2

table-row-group

n/a

5

6

2

Initial Value

Element-dependent.

Example

.hidden {display: none}

Applies To

All elements (but some display types are applicable to specific elements).

Object Model Reference

[window.]document.getElementById("elementID").style.display
 
elevationNN n/a IE n/a CSS 2

Inherited: Yes
Given a listener at the center of a three-dimensional sound space (like in a surround-sound-equipped theater), elevation sets the vertical angle of the source of the sound (for example, in a text-to-speech browser). See also the azimuth attribute.

CSS Syntax

elevation: angle | angleConstant

Value

Your choice of a specific angle (in degrees) or one of the five constant values. An angle value is any value in the range of -90 to +90 (inclusive) plus the letters "deg", as in 90deg. The value 0deg is at the same vertical level as the listener's ear. To set the angle above level, the value must be a positive value (45deg); below level requires a negative value (-45deg). Optionally, you can choose an angleConstant value from a library of descriptions that correspond to fixed points above and below level.

Value

Equals

above

90deg (directly overhead)

below

-90deg (directly beneath)

higher

+10 degrees from current

level

0deg (at listener's ear level)

lower

-10 degrees from current

In combination with the azimuth attribute, you can place a sound at any point around a spherical surround-sound stage.

Initial Value

level

Example

h1 {elevation: -45deg}
p.heavenly {elevation: above}

Applies To

All elements.

 
empty-cellsNN 6 IE n/a CSS 2

Inherited: Yes
Controls whether an empty td element shows its borders and background in a table. Surrounding cells don't change position when an empty cell is hidden. Instead, the cell is essentially transparent, allowing the table's background to show through in the space.

CSS Syntax

empty-cells: show | hide

Value

One of two constants: show | hide .

Initial Value

The CSS specification calls for a default value of show, but Netscape 6 renders as if the default is hide when running in quirks mode (i.e., specifying older DTDs in the DOCTYPE element).

Example

td {border: salmon inset 3px; empty-cells: hide}

Applies To

td elements.

 
filter (old style)NN n/a IE 4(Win) CSS n/a

Inherited: No
Sets the visual, reveal, or blend filter used to display or change content of an element. A visual filter can be applied to an element to produce effects such as content flipping, glow, drop shadow, and many others. A reveal filter is applied to an element when its visibility or appearance changes. The value of the reveal filter determines what visual effect is to be applied to the transition from hidden to shown (or vice versa). This includes effects such as wipes, blinds, and barn doors. A blend filter sets the speed at which a transition between visibility states occurs.

CSS Syntax

filter: filterType1(paramName1=value1, paramName2=value2,...) 
        filterType2(paramName1=value1,...) ...

Value

Each filter attribute may have more than one space-delimited filter type associated with it. Each filter type is followed by a pair of parentheses, which may convey parameters about the behavior of the filter for the current element. A parameter generally consists of a name/value pair, with assignment performed by the equals symbol. See the "Notes" section below for details on filterType values and parameters.

Initial Value

None.

Example

.fastStuff {filter: blur(add=true, direction=225)}

Applies To

body, button, img, input, marquee, table, td, textarea, tfoot, th, thead, tr, and absolute-positioned div and span elements.

Object Model Reference

[window.]document.getElementById("elementID").filters["filterName"]

Notes

First-generation filters (which continue to be supported at least through IE 6 for Windows) are divided into three broad categories: visual, reveal, and blend. Each category has its own parameter names. You can mix categories within a single filter attribute assignment and have quite a bit of fun experimenting with the combinations. Observe carefully the limitations about the elements to which you may assign filters.

The visual filters and their parameters are as follows:

alpha( )
Controls transparency level. The opacity and finishopacity parameters can be set from transparent (0) to opaque (100). The style parameter sets the opacity gradient shape: uniform (0), linear (1), radial (2), rectangular (3). startX and startY set the horizontal and vertical coordinates for opacity gradient start, whereas finishX and finishY set the horizontal and vertical coordinates for opacity gradient end.

blur( )
Gives the element the appearance of motion. The add parameter specifies whether to add the original image to the blurred image (1) or to omit it (0). direction sets the angle of the blurred image relative to the original image location: above (0); above-right (45); right (90); below-right (135); below (180); below-left (225); left (270); above-left (315). strength indicates the number of pixels for the blurred image to extend.

chroma( )
Sets a color transparent. The color parameter specifies the hexadecimal triplet value of the color to be made transparent.

dropShadow( )
Creates an offset shadow for apparent depth. The color parameter sets the hexadecimal triplet value of color for drop shadow. offx and offy specify the number of pixels between the element and the drop shadow along the x and y axes (positive values to the right/down; negative to the left/up). The positive parameter specifies whether only positive pixels generate drop shadows (1) or transparent pixels as well (0).

flipH( )
Creates a horizontally mirrored image of the element.

flipV( )
Creates a vertically mirrored image of the element.

glow( )
Adds radiance to outer edges. The color parameter sets the hexadecimal triplet value of the color for the radiance effect and strength sets the radiance intensity (1-255).

gray( )
Removes colors but retains luminance.

invert( )
Reverses the hue, saturation, and brightness (HSV) levels.

light( )
Shines a light source on the element (numerous filter method calls are available to set specific types of light sources, locations, intensities, and colors).

mask( )
Creates a transparent mask. The color parameter sets the hexadecimal triplet value of the color applied to transparent regions.

shadow( )
Displays the element as a solid silhouette. The color parameter sets the hexadecimal triplet value of the color used for shadows and direction sets the angle of the shadow relative to the original image location: above (0); above-right (45); right (90); below-right (135); below (180); below-left (225); left (270); above-left (315).

wave( )
Renders the element with a sine wave distortion along the x-axis. The add parameter specifies whether to add the original image to waved image (1) or not (0). freq sets the number of waves to be applied to visual distortion, light sets the light strength (0-100), phase sets the percentage offset for the sine wave (0-100 corresponding to to 360 degrees), and strength sets the wave effect intensity (0-255).

xRay( )
Renders only the edges.

The blend and reveal transition filters and parameters are as follows:

blendTrans( )
Fades the element in or out. The duration parameter sets the floating-point value (seconds.milliseconds) of how long the transition effect should take.

revealTrans( )
Sets a transition effect between appearance states of an element. The duration parameter sets the floating-point value (seconds.milliseconds) of how long the transition effect should take. transition is a key integer that corresponds to one of the following transition types.

Value

Transition type

Value

Transition type

0

Box in

12

Random dissolve

1

Box out

13

Split vertical in

2

Circle in

14

Split vertical out

3

Circle out

15

Split horizontal in

4

Wipe up

16

Split horizontal out

5

Wipe down

17

Strips left down

6

Wipe right

18

Strips left up

7

Wipe left

19

Strips right down

8

Vertical blinds

20

Strips right up

9

Horizontal blinds

21

Random bars horizontal

10

Checkerboard across

22

Random bars vertical

11

Checkerboard down

23

Random

Both transition filters have a set of three methods: apply( ), play( ), and stop( ). Use apply( ) to freeze the element's display while you change the element's visibility or other visual attribute; then invoke the play( ) method on the filter to let the transition be seen by the user:

document.getElementById("myImg").filters["revealTrans"].apply( );
document.getElementById("myImg").src = "newPix.jpg";
document.getElementById("myImg").filters["revealTrans"].play( );

A style sheet rule for the element may have been set to the following:

img {filter:revealTrans(transition=2, duration=3)}

When the script statements execute, the change from one image to another occurs through a "circle in" reveal transition.

 
filter (new style)NN n/a IE 5.5(Win) CSS n/a

Inherited: No
Sets the static or transition filter used to display or change content of an element with the help of the DXImageTransform ActiveX control, delivered with IE 5.5 or later for Windows. The purpose of the new filter mechanism is the same as the old style one, but the syntax for invoking the ActiveX control is new, as are many of the filter names.

CSS Syntax

filter:progid:DXImageTransform.Microsoft.filterType1(paramName1=value1, 
paramName2=value2,...) 
progid:DXImageTransform.Microsoft.filterType2(paramName1=value1,...) ...

Value

Each filter type must be preceded by the reference to the ActiveX control (progid:DXImageTransform.Microsoft.), and multiple filter types for a single filter style attribute are space delimited. Each filter type is followed by a pair of parentheses, which may convey parameters about the behavior of the filter for the current element. A parameter generally consists of a name/value pair, with assignment performed by the equals symbol. Filter types that control transitions also have methods that scripts invoke to freeze the display while some visible attribute of the element changes (also under script control) and then play the transition. (See the "Notes" section below for information about filterType values and parameters.

Initial Value

None.

Example

.fastStuff {filter:progid:DXImageTransform.Microsoft.MotionBlur(add=1, 
direction=225)}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").filters[
  "DXImageTransform.Microsoft.filterName"]

Notes

Documenting in detail ActiveX controls that work only on Windows versions of Internet Explorer exceeds the scope of this book. But by way of introduction to what the new filter scheme offers in IE 5.5 and later, the following table lists the static and trasition filters available in the DXImageTransform ActiveX control, along with descriptions of what they do. For specific details of attributes that go into style sheet rules, as well as the scriptable properties and methods available to each filter, visit http://msdn.microsoft.com/workshop/author/filter/filters.asp.

Filter name

Type

Description

Alpha( )

static

Controls transparency level (opacity)

Barn( )

transition

A barn-door transition effect, with properties for speed, motion, and orientation

BasicImage( )

static

Sets a variety of filter styles (mirror, opacity, grayscale, etc.) for all kinds of elements, but under script control can also rotate the element and alter its color mask

Blinds( )

transition

A venetian-blind transition effect, with properties for direction and thickness of the slats

Blur( )

static

Controls the fuzziness of the element

Checkerboard( )

transition

A checkboard transition effect with properties for direction, speed, and square sizes

Chroma( )

static

Controls the transparency of a specific color

Compositor( )

static

Combines color filter effects

DropShadow( )

static

Creates an offset shadow for apparent depth, with properties for color, and depth of shadow

Emboss( )

static

Controls an embossed texture effect

Engrave( )

static

Controls an engraved texture effect

Fade( )

transition

A blended transition between views, with properties for speed and the degree of overlap of both views

Glow( )

static

Controls radiance of outer edges

Gradiant( )

statics

Applies a colored gradient texture on the element's background

GradientWipe( )

transition

A wipe transition using a gradient blend at the wipe line, with properties for speed, thickness of the gradient, and direction

ICMFilter( )

static

Applies an external Image Color Management profile to the element

Inset( )

transition

A wipe transition that works along horizontal and vertical axes, but diagonally from one corner to its opposite

Iris( )

transition

A zoom-style transition with properties for speed, direction (in or out), and iris shape (e.g., circle, cross, diamond, plus, square, star)

Light( )

static

Controlled exclusively through scripts, adds effect of light source directed at the element

MaskFilter( )

static

Overlays a transparent mask for a color

Matrix( )

static

Control rotation, flipping, and scaling of element

MotionBlur( )

static

Simulates motion via artificial blurring

Pixelate( )

transition

Blends between views via an expansion/contraction and blurring/focusing of the content

RadialWipe( )

transition

Blends between views via your choice of styles (clock, wedge, radial)

RandomBars( )

transition

Blends between views via expanding/contracting bars, with properties for orientation and speed

RandomDissolve( )

transition

Blends between views through random pixel changes

Shadow( )

static

Displays element content as a silhouette

Slide( )

transition

Blends between views through banded sliding of various types

Spiral( )

transition

Blends between views through spiral reveals

Stretch( )

transition

Blends between views through various stretch-style reveals

Strips( )

transition

Blends between views with striped effect

Wave( )

static

Adds sine-wave distortion to the element

Wheel( )

transition

Blends between views via wheel spokes emanating from the element center

ZigZag( )

transition

Blends between views via removal of rows of bricks

Successful deployment of these filters, especially on complex content, requires extensive experimentation and testing to make sure that your combination doesn't crash the browser.

 
floatNN 4 IE 4 CSS 1

Inherited: No
Determines on which side of the containing box the element aligns so that other content wraps around the element. When the attribute is set to none, the element appears in its source code sequence, and at most, one line of surrounding text content appears in the same horizontal band as the element.

Due to the prior reservation of float as a keyword in JavaScript, the attribute name is not available as a style object property name in object models that use JavaScript. Internet Explorer adopted the styleFloat property name; the W3C DOM and Netscape 6 use cssFloat.

CSS Syntax

float: alignmentSide | none

Value

An alignmentSide is one of the following constants: left | right.

Initial Value

none

Example

img.navButton {float: right}

Applies To

All elements except positioned elements (or generated content).

Object Model Reference

[window.]document.getElementById("elementID").style.styleFloat
[window.]document.getElementById("elementID").style.cssFloat
 
fontNN 6 IE 4 CSS 1

Inherited: Yes
This is a shorthand attribute that lets you set multiple font-related attributes with one assignment statement. Some browsers are more forgiving than others about required and optional values, but this attribute should at least specify the font-size and font face (either by font-family or CSS2FontConstant values) in that order. The order of other space-delimied value types is not critical. In CSS2, some additional short-circuit constants apply named system fonts that have fixed values for each of the font-related attributes.

CSS Syntax

font: font-style || font-variant || font-weight || font-size[/line-height] ||
font-family | CSS2FontConstant

Value

For syntax and examples of value types for font and line attributes, see the respective attribute listing. The construction with the forward slash before the line-height value allows the use of a second length value within the potentially long sequence of values for this attribute: the line-height length value must always accompany the required font-size value, separated by a forward slash.

The CSS2 font constants are as follows: caption | icon | menu | message-box | small-caption | status-bar. These constants refer to browser and operating system fonts used by the client. Their precise appearance is therefore different on different operating systems but consistent with the user's expectation for a particular type of font. In other words, these styles should be used when their function mirrors a system or browser function.

Initial Value

None.

Example

body {font: 12px serif}
h2 {font: bolder small-caps 16px "Lucida Console", Arial, sans-serif}
.iconCaption {font: 10px/1.1em caption}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.font
 
font-familyNN 4 IE 4 CSS 1

Inherited: Yes
Sets a prioritized list of font families to be used to render the content. One or more font family names may be included in a comma-delimited list of attribute values. If a font family name consists of multiple words, the family name must be inside quotes.

A font family may consist of multiple font definitions. For example, a Helvetica font family may also include a bold version and an italic version—genuinely distinct fonts rather than the approximated versions of bold and italic. When you specify a font family by name, the browser looks into the client's system to see if there is a font available by that name. If not, the browser looks to the next font family name in the list. Therefore, it is wise to include font family names in a sequence that goes from the most esoteric to the most generic. The final font family name should be the generic family (serif, sans-serif, cursive, fantasy, or monospace) that most closely resembles the desired font. Many fonts that are widely installed on one operating system may not be as popular on another operating system.

Browsers following the CSS2 specification should also be smart enough to recognize Unicode character codes and try to match them with named font families that cater to particular languages. Ideally, this will allow a browser to mix fonts from different languages and writing systems in the same element, provided each font-family is listed in the attribute value.

CSS Syntax

font-family: fontFamilyName [, fontFamilyName [, ...]]

Value

Any number of font family names, comma delimited. Multiword family names must be quoted. Recognized generic family names are: serif | sans-serif | cursive | fantasy | monospace.

Initial Value

Browser default.

Example

body {font-family: "Century Schoolbook", Times, serif}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.fontFamily

Notes

Internet Explorer provide facilities for downloading font definition files for a browser that doesn't have a special font that the page designer wants for the page. The font definition files must be created by the author using browser-specific font conversion tools. An @font-face style sheet rule downloads the font definition file and associates that font description with an arbitrary font family name:

@font-face {font-family:Neato; src: url(http://www.giantco.com/fonts/neato.eot}

See Section 11.3 earlier in this chapter for details on deploying this type of style rule. You then specify the font in regular font-family style attributes. If the font has yet to download, the browser displays the page in another font until the downloadable font has arrived. At that point, the page is reflowed with the downloaded font.

 
font-sizeNN 4 IE 4 CSS 1

Inherited: Yes
Determines the font size of the element. The font size can be set in several ways. A collection of constants (xx-small, x-small, small, medium, large, x-large, xx-large) defines what are known as absolute sizes. In truth, these are absolute as far as a single browser in a single operating system goes because the reference point for these sizes varies with browser and operating system (analogous to the old HTML font sizes of 1 through 7). See
Figure 11-4 and Figure 11-5 for size comparisons viewed on the same video monitors. But they let the author have confidence that one element set to large is rendered larger than another set to medium.

Figure 11-4

Figure 11-4. Font size constant values in Netscape 6 on the Windows and Mac platforms

Figure 11-5

Figure 11-5. Font size constant values in IE on the Windows and Mac platforms

Another collection of constants (larger, smaller) are known as relative sizes. Because the font-size attribute is inherited from the parent element, these relative sizes are applied to the parent element to determine the font size of the current element. It is up to the browser to determine exactly how much larger or smaller the font size is, and a lot depends on how the parent element's font size is set. If it is set with one of the absolute sizes (large, for example), a child's font size of larger means that the font is rendered in the browser's x-large size. The increments are not as clear cut when the parent font size is set with a length or percentage.

If you elect to use a length value for the font-size attribute, choose a unit that makes the most sense for fonts rendered on the output medium, such as pixels (px) for screen display and points (pt) or ems (em) for printed output. Em values are calculated relative to the size of the parent element's font size. Finally, you can set the font-size to a percentage, which is calculated based on the size of the parent element's font size.

Some browsers hijack your best efforts at precisely sizing fonts, using their own (or user) settings to establish a "medium" size. That is why many designers prefer to rely on the relative-size constants for their font-size specification schemes. This choice means giving up a level of control over rendering from one browser and operating system to the next, but attempting too strict control on uniform rendering generally leads to utter frustration.

CSS Syntax

font-size: absoluteSize | relativeSize | length | percentage

Value

For an absolute size, one of the following constants: xx-small | x-small | small | medium | large | x-large | xx-large. For a relative size, one of the following constants: larger | smaller. For a length, see the discussion about length values at the beginning of this chapter. For a percentage, the percentage value and the % symbol.

Initial Value

medium (for BODY element); the parent element's font-size value (for all others).

Example

body {font-size: 14pt}
p.teeny {font-size: x-small}
em {font-size: larger}
span.larger {font-size: 150%}

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.fontSize
 
font-size-adjustNN n/a IE n/a CSS 2

Inherited: Yes
Allows an element to preserve the x-height (measured in exes) of a "first choice" font when substituting fonts. The z-factor is a ratio of the em- to x-heights of a font. Because different fonts set to the same font size can look larger or smaller than neighboring fonts on a page set to the same size, the z-factor can be used to calculate the ratio and apply it to other fonts. Even though the resulting font size may be larger or smaller than the "first choice" font setting, the perceived size is much more accurate. This also tends to equalize the horizontal metrics of fonts so that word-wrapped lines break at the same place with different font families.

CSS Syntax

font-size-adjust: 0.47

Value

A number representing the aspect value of the preferred font (perhaps obtainable from the font maker) or none.

Initial Value

none

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.fontSizeAdjust
 
font-stretchNN n/a IE n/a CSS 2

Inherited: Yes
Sets the rendered font to a letter-spacing relative of the specified font family. Version 6 browsers do not take it upon themselves to artificially condense or expand font family specifications.

CSS Syntax

font-stretch: stretchType | normal

Value

For an absolute size, one of the following constants: ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | extra-expanded | ultra-expanded. For a relative size, one of the following constants: narrower | wider.

Initial Value

normal

Applies To

All elements.

Object Model Reference

[window.]document.getElementById("elementID").style.fontStretch
 
font-styleNN 4 IE 4 CSS 1

Inherited: Yes
Determines whether the element is rendered in a normal (Roman), italic, or oblique font style. If the font-family includes font faces labeled Italic and/or Oblique, the setting of the font-style attribute summons those particular font faces from the browser's system. But if the specialized font faces are not available in the system, the normal font face is usually algorithmically slanted to look italic. Output sent to a printer with such font settings relies on the quality of arbitration between the client computer and printer to render an electronically generated italic font style. Although personal computer software typically includes other kinds of font rendering under the heading of "Style," see font-stretch, font-variant, and font-weight for other kinds of font "styles."

CSS Syntax

font-style: fontStyle

Value

One of the following constants: normal | italic | oblique. Browsers tend to treat italic and oblique settings the same.