Book HomeHTML & XHTML: The Definitive GuideSearch this book

Appendix C. Cascading Style Sheet Properties Quick Reference

In the following table, we list in alphabetical order all the properties defined in the World Wide Web Consortium's Recommended Specification for Cascading Style Sheets, Level 1 (http://www.w3.org/pub/WWW/TR/REC-CSS1).

TIP

We know that browser support of style sheets will change faster than we can reprint this book, so we have created a separate "compliance document" that you can use to determine how style sheets are implemented by the latest releases of the browsers. You can find this document at http://www.oreilly.com/catalog/html4/. Whenever that document and this appendix differ, the document should be considered more accurate. In this printing, we cover Netscape Navigator 4.7 and Internet Explorer 5.0.

As in other sections of this book, we use the Netscape and Internet Explorer icons to the far right of each property to show which browser supports that property. Properties with no icons are not currently supported by any browser. We also include the number of the section in this book that fully defines the property.

We include each property's possible values, defined as either an explicit keyword (shown in constant width) or as one of these values:

color

Either a color name or hexadecimal RGB value, as defined in Appendix G, "Color Names and Values", or an RGB triple of the form:

rgb(red, green, blue)

where red, green, and blue are either numbers in the range to 255 or percentage values indicating the brightness of that color component. Values of 255 or 100% indicate that the corresponding color component is at its brightest; values of 0 or 0% indicate that the corresponding color component is turned completely off. For example:

rgb(27, 119, 207)
rgb(50%, 75%, 0%)

are both valid color specifications.

length

An optional sign (either + or -) immediately followed by a number (with or without a decimal point) immediately followed by a two-character unit identifier. For values of zero, the unit identifier may be omitted.

The unit identifiers em and ex refer to the overall height of the font and to the height of the letter "x", respectively. The unit identifier px is equal to a single pixel on the display device. The unit identifiers in, cm, mm, pt, and pc refer to inches, centimeters, millimeters, points, and picas, respectively. There are 72.27 points per inch, and 12 points in a pica.

number

An optional sign, immediately followed by a number (with or without a decimal point).

percent

An optional sign, immediately followed by a number (with or without a decimal point), immediately followed by a percent sign. The actual value is computed as a percentage of some other element property, usually the element's size.

url

The keyword url, immediately followed (no spaces) by a left parenthesis, followed by a URL optionally enclosed in single or double quotes, followed by a matching right parenthesis. For example:

url("http://members.aol.com/htmlguru")

is a valid URL value.

Finally, some values are lists of other values and are described as a "list of" some other value. In these cases, a list consists of one or more of the allowed values, separated by commas.

If there are several different values allowed for a property, these alternative choices are separated by vertical bars (|).

If the standard defines a default value for the property, that value is boldfaced.

background

 

Composite property for the background-attachment,background-color, background-image, background-position, and background-repeat properties; value is any of these properties' values, in any order

Section 8.4.4.6, "The background property"

background-attachment

scroll | fixed

Determines if the background image is fixed in the window or scrolls as the document scrolls

Section 8.4.4.1, "The background-attachment property"

background-color

color | transparent

Sets the background color of an element

Section 8.4.4.2, "The background-color property"

background-image

url | none

Sets the background image of an element

Section 8.4.4.3, "The background-image property"

background-position

percent | length | top | center | bottom | left | right

Sets the initial position of the element's background image, if specified; values are normally paired to provide x, y positions. Default position is 0% 0%

Section 8.4.4.4, "The   background-position property"

background-repeat

repeat | repeat-x | repeat-y | no-repeat

Determines how the background image is repeated (tiled) across an element

Section 8.4.4.5, "The     background-repeat property"

border

 

Sets all four borders on an element; value is one or more of a color, a value for border-width, and a value for border-style

Section 8.4.6.6, "Borders in shorthand"

border-bottom

 

Sets the bottom border on an element; value is one or more of a color, a value for border-bottom-width, and a value for border-style

Section 8.4.6.6, "Borders in shorthand"

border-bottom-width

length | thin | medium | thick

Sets the thickness of an element's bottom border

Section 8.4.6.4, "The border-width property"

border-color

color

Sets the color of all four of an element's borders; default is the color of the element

Section 8.4.6.3, "The border-color property"

   

border-left

 

Sets the left border on an element; value is one or more of a color, a value for border-left-width, and a value for border-style

Section 8.4.6.6, "Borders in shorthand"

   

border-left-width

length | thin | medium | thick

Sets the thickness of an element's left border

Section 8.4.6.4, "The border-width property"

border-right

 

Sets the right border on an element; value is one or more of a color, a value for border-right-width, and a value for border-style

Section 8.4.6.6, "Borders in shorthand"

border-right-width

length | thin | medium | thick

Sets the thickness of an element's right border

Section 8.4.6.4, "The border-width property"

border-style

dashed | dotted | double | groove | inset | none | outset | ridge | solid

Sets the style of all four of an element's borders

Section 8.4.6.5, "The             border-style property"

border-top

 

Sets the top border on an element; value is one or more of a color, a value for border-top-width, and a value for border-style

Section 8.4.6.6, "Borders in shorthand"

border-top-width

length | thin | medium | thick

Sets the thickness of an element's top border

Section 8.4.6.4, "The border-width property"

border-width

length | thin | medium | thick

Sets the thickness of all four of an element's borders

Section 8.4.6.4, "The border-width property"

clear

both | left | none | right

Sets which margins of an element must not be adjacent to a floating element; the element will be moved down until that margin is clear

Section 8.4.6.7, "The clear property"

color

color

Sets the color of an element

Section 8.4.4.7, "The color property"

display

block | inline | list-item | none

Controls how an element is displayed

Section 8.4.8.1, "The display property"

float

left | none | right

Determines if an element will float to the left or right, allowing text to wrap around it, or be displayed inline (using none)

Section 8.4.6.8, "The float property"

font

 

Sets all the font attributes for an element; value is any of the values for font-style, font-variant, font-weight, font-size, line-height, and font-family, in that order

Section 8.4.3.8, "The font property"

font-family

list of font names

Defines the font for an element, either as a specific font or as one of the generic fonts serif, sans-serif, cursive, fantasy, and monospace

Section 8.4.3.1, "The font-family property"

font-size

xx-small | x-small | small | medium | large | x-large | xx-large | larger | smaller | length | percent

Defines the font size

Section 8.4.3.2, "The font-size property"

font-size-adjust

none | ratio

Adjusts the current font aspect ratio

Section 8.4.3.4, "The font-size-adjust property"

 

font-stretch

wider | normal | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded

Determines the amount to stretch the current font

Section 8.4.3.3, "The font-stretch property"

 

font-style

normal | italic | oblique

Defines the style of the face, either normal or some type of slanted style

Section 8.4.3.5, "The font-style property"

font-variant

normal | small-caps

Defines a font to be in small caps

Section 8.4.3.6, "The font-variant property"

font-weight

normal | bold | bolder | lighter | number

Defines the font weight. If a number is used, it must be a multiple of 100 between 100 and 900; 400 is normal, 700 is the same as the keyword bold.

Section 8.4.3.7, "The font-weight property"

height

length | auto

Defines the height of an element

Section 8.4.6.9, "The height property"

letter-spacing

length | normal

Inserts additional space between text characters

Section 8.4.5.1, "The letter-spacing property"

line-height

length | number | percent | normal

Sets the distance between adjacent text baselines

Section 8.4.5.2, "The line-height property"

list-style

 

Defines list-related styles using any of the values for list-style-image, list-style-position, and list-style-type

Section 8.4.7.4, "The list-style property"

list-style-image

url | none

Defines an image to be used as a list item's marker, in lieu of the value for list-style-type

Section 8.4.7.1, "The list-style-image property"

list-style-position

inside | outside

Indents or extends (default) a list item's marker with respect to the item's content

Section 8.4.7.2, "The list-style-position property"

 

list-style-type

circle | disc | square | decimal | lower-alpha | lower-roman | none | upper-alpha | upper-roman

Defines a list item's marker for either unordered lists (circle, disc, or square) or for ordered lists (decimal, lower-alpha, lower-roman, none, upper-alpha, or upper-roman)

Section 8.4.7.3, "The list-style-type property"

margin

length | percent | auto

Defines all four of an element's margins

Section 8.4.6.10, "The margin properties"

margin-bottom

length | percent | auto

Defines the bottom margin of an element; default value is 0

Section 8.4.6.10, "The margin properties"

margin-left

length | percent | auto

Defines the left margin of an element; default value is 0

Section 8.4.6.10, "The margin properties"

margin-right

length | percent | auto

Defines the right margin of an element; default value is 0

Section 8.4.6.10, "The margin properties"

margin-top

length | percent | auto

Defines the top margin of an element; default value is 0

Section 8.4.6.10, "The margin properties"

padding

 

Defines all four padding amounts around an element

Section 8.4.6.11, "The padding properties"

padding-bottom

length | percent

Defines the bottom padding of an element; default value is 0

Section 8.4.6.11, "The padding properties"

padding-left

length | percent

Defines the left padding of an element; default value is 0

Section 8.4.6.11, "The padding properties"

padding-right

length | percent

Defines the right padding of an element; default value is 0

Section 8.4.6.11, "The padding properties"

padding-top

length | percent

Defines the top padding of an element; default value is 0

Section 8.4.6.11, "The padding properties"

text-align

center | justify | left | right

Set the text alignment style for an element

Section 8.4.5.3, "The text-align property"

text-decoration

blink | line-through | none | overline | underline

Defines any decoration for the text; values may be combined

Section 8.4.5.4, "The text-decoration property"

text-indent

length | percent

Defines the indentation of the first line of text in an element; default value is

Section 8.4.5.5, "The text-indent property"

text-shadow

See text

Creates text drop shadows of varying colors and offsets

8.4.5.6

 

text-transform

capitalize | lowercase | none | uppercase

Transforms the text in the element accordingly

8.4.5.7

vertical-align

percent | baseline | bottom | middle | sub | super | text-bottom | text-top | top

Sets the vertical positioning of an element

8.4.5.8

word-spacing

length | normal

Inserts additional space between words

8.4.5.9

white-space

normal | nowrap | pre

Defines how whitespace within an element is handled

Section 8.4.8.2, "The white-space property"

   

width

length | percent | auto

Defines the width of an element

Section 8.4.6.12, "The width property"



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.