CSS Level 1 and CSS-P Quick Reference Chart (1)
Brief Property Descriptions
Property | Description | Page Refs. |
background | Shorthand for setting next five background properties (color, image, attachment, image position and image tiling rules) | 79, 200, 576 |
background-attachment | Set background to scroll with the page (default) or to remain fixed with the page scrolling on top of it. | 200, 576-578 |
background-color | Sets the background color for an element. Note that background color is opaque, and hides whatever is behind it. | 56-57, 73, 78, 192-193, 578 |
background-image | Sets (using a URL) the image to use as a background. The image is tiled according to the rules set by background-repeat. | 78, 135-136, 193, 579 |
background-position | Set position for initial placement of the background image -tiling starts from this position. Applies only to block elements. | 195-199, 579 |
background-repeat | Define how the background image is tiled (e.g., left-to right only, top-to-bottom only, or not at all). | 193-195, 580 |
border | Shorthand for setting identical border widths and properties for all four borders around an element. | 580 |
border-bottom | Sets the border properties (size, style and color) for the border at the bottom of an element. | 135, 181-189, 581 |
border-bottom-width | Sets the width of the border at the bottom of an element. With inline elements, this does not affect line spacing. | 174, 181-189, 582 |
border-color | Shorthand for setting the color for all four borders. The default color is set by the color property. | 583 |
border-left | Sets the border properties (size, style and color) for the border at the left of an element. | 135, 584 |
border-left-width | Sets the width of the border to the left of an element. With inline elements this does affect spacing between the element and text to it's left. | 174, 175-181, 585 |
border-right | Sets the border properties (size, style and color) for the border at the right of an element. | 585 |
border-right-width | Sets the width of the border to the left of an element. With inline elements, this does affect spacing between the element and text to it's right. | 174, 175-181, 586 |
border-style | Shorthand for setting the style (solid, dashed, etc.) for all four borders around an element. | 587 |
border-top | Sets the width of the border at the top of an element. With inline elements this does not affect line spacing. | 56-57, 115, 135, 587 |
border-top-width | Sets the width of the border at the top of an element. With inline elements this does not affect line spacing. | 174, 181-189, 588 |
border-width | Shorthand for setting the widths of all four borders of an element. | 588 |
clear | Clear an element to move down so that the margin is clear to the left (clear: left), to the right (clear: right) or to both margins (clear: both). (Analogous to - and replaces - the HTML markup <br clear="left">, etc.) | 276-277, 279, 590 |
color | Set the foreground (i.e., text) color. This is also the default color for element borders. | 56-57, 83-87, 591 |
display | Defines the display type (i.e. block, inline, or list-item) for the element. The value "none" removes the element from display -- the page is formatted as if the element were not part of the document. | 200-201, 310, 329, 594 |
float | Float an element to the left or right (or turn floating off). This "floats" an element within the block element the element is directly inside. (Analogous to - and replaces - align="left" (etc.) attributes on HTML img elements). | 140, 201, 204, 265, 268-270, 340, 596 |
font | Shorthand for setting properties of the text font (family, size, weight, variant, style, and line height) | 596 |
font-family | Specify the desired font family for the text in an element. Given as a comma-separated list of desired fonts, in decreasing order of preference. | 55-57, 73-76, 448, 450-451, 597 |
font-size | Sets the desired size for text inside the element. | 57, 76-77, 451, 598 |
font-style | Sets the style (e.g., italic) for text inside the element. | 73, 77, 598 |
font-variant | Set the variant (e.g. small-caps) for text inside the element. | 73, 77, 79, 80, 451, 599 |
font-weight | Set the weight or boldness for text inside the element. | 73, 77, 599 |
height | Sets the height for an element, Relevant only for block elements, replaced elements (such as inline images), and absolutely positioned element (see position). | 128-131, 173, 174, 181-189, 204-206, 600 |
letter-spacing | Adjust the spacing between letters relative to a default value. Negative values can lead to overlapping letters. | 77, 602 |
line-height | Set the line height or spacing between lines inside a block element. | 169-173, 602 |
list-style | Shorthand for setting the three list style properties described below. | 189, 603 |
list-style-image | Set (using a URL) an image to use as the marker for the list items. This overrides the marker set by list-style-type. | 189-191, 603 |
list-style-position | Set whether list items should wrap around the list item marker (inside) or should line up next to the marker (outside). | 188-191, 603 |
list-style-type | Set the type of the list, and the marker to use for the items (e.g., circles, digits, roman numbers, etc.) | 188-191, 604 |
margin | Shorthand for setting the margins on all four sides of an element (can set different margin settings on each side) | 173-174, 604 |
margin-bottom | Set the margin length (positive or negative) at the top of an element. With inline elements, this does not affect line spacing to the next line. | 174, 181-189, 269-273, 605 |
margin-left | Set the margin length (positive or negative) to the left of an element. With inline elements, this does affect spacing between the element and text to it's left. | 173-181, 269-273, 605 |
margin-right | Set the margin length (positive or negative) to the right of an element. With inline elements, this does affect spacing between the element and text to it's right. | 174,-181, 269-273, 282, 606 |
margin-top | Set the margin length (positive or negative) at the top of an element. With inline elements, this does not affect line spacing from the preceding line. | 174, 181-189, 269-273, 282, 606 |
padding | Shorthand for setting padding space on all sides of an element (can set different padding sizes for all four sides) | 115, 135-136, 173-174, 610 |
padding-bottom | Set padding space at the bottom of an element. With inline elements, this does not affect line spacing. | 174, 181-189, 611 |
padding-left | Set padding space for the left side of an element. . With inline elements this does affect spacing between the element and text to it's left. | 174, 175-181, 612 |
padding-right | Set padding space for the right side of an element. With inline elements, this does affect spacing between the element and text to it's right. | 174-181, 613 |
padding-top | Set padding space at the top of an element. With inline elements, this does not affect line spacing. | 174, 181-189, 613 |
Property Descriptions (Cont.)
Property | Description | Page Refs. | |
text-align | Set text alignment (left, right, justify, center) for text inside a block element. (Analogous to - and replaces - align="left" (etc.) attributes on HTML block elements such as p or div). | 147, 164, 204, 371, 615 | |
text-decoration | Set the text decoration (underline, strike-through, etc.) for the text content. | 73, 77-78, 616 | |
text-indent | Set the indent (positive or negative) for the first line of a block element. Negative value produce a 'hanging' indent. | 164-165, 617 | |
text-transform | Transforms text before it is displayed, (e.g., to uppercase, to lowercase, or capitalize all first letters) | 78, 617 | |
vertical-align | Define how an element is vertically aligned relative to adjacent content, (e.g., super- or subscripts, middle-alignment, baseline-alignment, etc.) Applies only to inline elements. | 115, 131-134, 139, 370, 619 | |
white-space | Defines how white space should be handled inside the element (e.g., preserve them (like inside an HTML pre element), collapse them, or disallow line wrapping in the absence of line breaks) | 166-168, 621 | |
width | Sets the width for an element, Relevant only for block elements and replace elements (such as inline images). | 128-131, 173-174,-181, 204-206, 375-377, 621 | |
word-spacing | Adjust the spacing between words relative to the default value. Negative values may cause words to overlap. Applies only to block elements. | 78, 164, 623 | |
CSS Positioning Properties | |||
clip | Sets a clipping window for positioned elements -- content outside the window can be clipped (see overflow). | 310, 315, 3316-317, 590 | |
left | Defines the position of the left side of a positioned element relative to a well-defined origin. The origin depends on how the element is positioned (absolute or relative). | 310, 312-314, 319-321, 601 | |
overflow | Defines how clipped content should be displayed. The value clip means that content outside the clipping window is clipped, while scroll calls for scrollbars inside the clipping window, if needed. | 310, 315-319, 182-184, 281-282, 610 | |
position | Sets the positioning model for an element: absolute and relative define the special CSS-Positioning models; the default is static, which corresponds to the standard (non-positioned) mechanism. | 309, 310-317, 613 | |
top | Defines the position of the top side of a positioned element relative to a well-defined origin. The origin depends on how the element is positioned (absolute or relative). | 310, 312-314, 319-321, 618 | |
visibility | Sets whether or not the element content is visible or invisible. | 310, 324-329, 382-385, 620 | |
z-index | Positioned elements can appear one above the other - z-index defines the order in which they appear (relative to the other specially positioned elements). | 310, 311, 314-315, 322-326, 623 |
Pseudo-Elements, Pseudo-Classes and Special Declarations
Term | Description | Page Refs. | |
A) Pseudo-Elements | |||
:first-line | Selects for the first line in a block element, and applies only to block elements (e.g. p:first-line) | 168-170 | |
:first-letter | Selects for the first letter in an element (e.g., span:first-letter) | 168-170 | |
B) Pseudo-Classes | |||
:link | Select for hypertext links that are links to elsewhere (i.e., have an href attribute) (e.g. a:link) | 108-109, 110, 112 | |
:visited | Selects for hypertext links that are links to elsewhere and that have already been visited by the user. | 108,109, 110-112 | |
:active | Selects for hypertext links that are links to elsewhere and that are active (i.e., the user has selected the link) | 110, 112 | |
:hover (CSS Level 2) | Selects for elements the mouse pointer is "hovering" above: often used to change the background color behind links when the mouse "rolls over" the link. (e.g. a:link:hover) | 109-111, 111-112 | |
C) Other CSS Declarations | |||
!important | Appears at the end of a declaration (e.g., color: red !important) and raises the 'weight' of the declaration so that it overrides all others that might apply to the same element. | 87, 443, 445-448 | |
@import | Used to import an external style sheet inline into the current style sheet. Must appear at the start of the style sheet. (E.g., import url(http://somewhere.org/styles/mystyle.css); ) | 443-445, 446 |
CSS Level 1 Selectors
Selector Example | Description | Page Refs. |
div.main | Class-based selector: Selects all div elements having the attribute class="main" | 56, 81, 460 |
pre#special | ID-based selector: Selects all pre elements having the attribute id="special" (Note: there can be only one such elements -- no two elements in a document can have the same id attribute value) | 82, 84, 460 |
.main | Select for all elements of any type having the attribute class="main" | 81, 460 |
div.main em | Contextual selector: Selects for em elements that are somewhere inside a div element having the attribute class="foo" | 82, 460 |
a.navbar:visited | Selects for a elements corresponding to already visited hypertext links that also have the attribute class="navbar" | 108-112, 460 |
span | Element-based selector: Selects for all span elements | 55-56, , 460 |
p em, div.foo | Grouped selector: Selects for all em elements somewhere inside a p element, and also, selects for all div elements of class="foo". | 56, 460 |
Page References: Refer to pages in The XHTML 1.0 Language and Design Sourcebook |
CSS Level 1 and CSS-P Quick Reference Chart
Property values, elements to which properties apply, and browser support
(Table key on next page)
Property | Supported Values | Inherit? (Y = yes) | Applies to Elements: |
Browser Support |
||||||
NN4.x | NN6 | IE4.x | IE5 | IE5.5 | OP3.6 | OP4.02 | ||||
background | shorthand for background properties | A | P,B | Y | B | Y | Y | P | Y,B | |
background-attachment | scroll, fixed | A | — | Y | Y | Y | Y | — | Y | |
background-color | color, transparent | A | P,B | Y | Y | Y | Y | Y | B | |
background-image | url(urlstring), none | A | Y | Y | Y | Y | Y | Y | Y | |
background-position | several possible values (see text) | B, R | — | Y | B | Y | Y | Y | Y | |
background-repeat | no-repeat, repeat, repeat-x, repeat-y | A | P | Y | B | Y | Y | Y | Y | |
border | shorthand for border properties | A | P,B! | Y | Y | Y,P | Y | |||
border-bottom | shorthand for bottom border properties | A | — | Y | P | P (Y Mac) | Y | Y,P | Y | |
border-bottom-width | medium, thick, thin, length | A | Y | Y | P | P (Y Mac) | Y | Y | Y | |
border-color | 1 to 4 color values | A | P | Y | Y | Y | Y | Y | Y | |
border-left | shorthand for left border properties | A | — | Y | P | P (Y Mac) | Y,P | Y | ||
border-left-width | medium, thick, thin, length | A | P | Y | P | P (Y Mac) | Y | Y | Y | |
border-right | shorthand for right border properties | A | — | Y | P | P (Y Mac) | Y | Y,P | Y | |
border-right-width | medium, thick, thin, length | A | Y | Y | P | P (Y Mac) | Y | Y | Y | |
border-style | 1 to 4 values, each being dashed, dotted, double, groove, inset, none, outset, ridge, solid | A | P | Y | P | P | P | Y | Y | |
border-top | shorthand for top border properties | A | — | Y | P | P (Y Mac) | Y | Y,P | Y | |
border-top-width | medium, thick, thin, length | A | Y | Y | P | P (Y Mac) | Y | Y | Y | |
border-width | shorthand for four border widths | A | B | Y | P | P | Y | Y | Y | |
clear | both, left, none, right | A | B | Y | B (Y Mac) | B (Y Mac) | Y | P (no left) | Y | |
color | color |
Y |
A | Y | Y | Y | Y | Y | Y | Y |
display | block, inline, list-item, none | A | B | Y | B | P (Y Mac) | P | P,B (no lists) | Y | |
float | left, none, right | A | B! | Y | B! | B (Y Mac) | Y | Y,B | B | |
font | shorthand for font properties |
Y |
A | P | Y | Y | Y | Y | Y | Y |
font-family | comma-separated font names |
Y |
A | P | Y | Y | Y | Y | Y | Y |
font-size | xx-small, x-small, small, medium, large, x-large, xx-large, larger, smaller, length, num% |
Y |
A | Y | Y | B | Y | Y | Y | Y |
font-style | normal, italic, oblique |
Y |
A | P | Y | Y | Y | Y | Y | Y |
font-variant | normal, small-caps |
Y |
A | — | Y | Y | Y | Y | Y | Y |
font-weight | bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900 |
Y |
A | P | Y | Y | Y | Y | Y | Y |
height | auto, length, num% | B, R, AP | P,B | Y | Y | Y | Y | Y | Y | |
letter-spacing | normal, length |
Y |
A | — | Y | Y | Y | Y | Y | Y |
line-height | normal, length, num, num% |
Y |
B | P,B | Y | Y | Y | Y | Y | Y |
list-style | shorthand for list properties |
Y |
L | P | Y | Y | Y | Y | Y | Y |
list-style-image | url(urlstring), none |
Y |
L | — | Y | Y | Y | Y | Y | Y |
list-style-position | inside, outside |
Y |
L | — | Y | Y | Y | Y | Y | Y |
List-style-type | circle, disc, none, square, decimal, lower-alpha, lower-roman, upper-alpha, upper-roman |
Y |
L | Y | Y | Y | Y | Y | Y | Y |
margin | shorthand for margin properties | A | P,B | Y | P,B | P (Y Mac) | Y | Y | Y | |
margin-bottom | auto, length, num% | A | B | Y | P,B | P (Y Mac) | Y | Y | Y | |
margin-left | auto, length, num% | A | B | Y | P,B | P (Y Mac) | Y | Y | B | |
margin-right | auto, length, num% | A | B | Y | P,B | P (Y Mac) | Y | Y | B | |
margin-top | auto, length, num% | A | B | Y | P,B | P (Y Mac) | Y | Y | Y | |
padding | shorthand for padding properties | A | B | Y | P | P (Y Mac) | Y | B | Y | |
padding-bottom | length, num% | A | B | Y | P | P (Y Mac) | Y | Y | Y | |
padding-left | length, num% | A | B | Y | P | P (Y Mac) | Y | Y | Y | |
padding-right | length, num% | A | B | Y | P | P (Y Mac) | Y | Y | Y | |
padding-top | length, num% | A | B | Y | P | P (Y Mac) | Y | Y | Y | |
text-align | center, justify, left, right |
Y |
B | Y | Y | Y | Y | Y | Y | Y |
text-decoration | none, or one or more of: blink, line-through, overline, underline | A | P | Y | P(no blink) | P(no blink) | P(no blink) | P (no blink) | Y | |
text-indent | length, num% |
Y |
B | Y | Y | Y | Y | Y | Y | Y |
text-transform | capitalize, lowercase, none, uppercase |
Y |
A | Y | Y | Y | Y | Y | P,B | Y |
Property values ... (Cont.)
Property | Values | Inherit? (Y = yes) | Applies to Elements: |
Browser Support |
||||||
NN4.x | NN6 | IE4.x | IE5.x | IE5.5 | OP3.6 | OP4.02 | ||||
vertical-align | baseline, sub, super ,top, text-top, middle, bottom, text-bottom, num% | I | P,B | Y | P | P (Y Mac) | P | P.B | Y | |
white-space | normal, nowrap, pre |
Y |
B | P | Y | — | — (Y Mac) | P | — | Y |
width | auto, length, num% | B, R, AP | B | Y | B | B (Y Mac) | Y | Y,B | Y | |
word-spacing | normal, length |
Y |
A | — | Y | — (Y Mac) | — (Y Mac) | — | Y | Y |
CSS Positioning Properties | ||||||||||
clip | auto, rect(len1, len2, len3, len4) | AP | Y | Y | B | Y | Y | — | — | |
left | auto, length, num% | AP,RP | Y | Y | B | Y | Y | — | B | |
overflow | none, clip, scroll | AP,RP | Y | Y | B | Y | Y | — | P | |
position | absolute, relative, static | A | Y | Y | B | Y | Y | — | B | |
top | auto, length, num% | AP,RP | Y | Y | B | Y | Y | — | B | |
visibility | hidden, inherit, visible |
(Y if inherit) |
A | B (no visible) | Y | B | Y | Y | — | B |
z-index | auto, int | AP,RP | Y | Y | B | Y | Y | — | — |
Pseudo-Elements, Pseudo-Classs and Special CSS Declarations | ||||||||||
:first-line | — | Y | — | — (Y Mac) | Y | Y | Y | |||
:first-letter | — | B | — | — (Y Mac) | Y | Y | Y | |||
:link | Y | Y | Y | Y | Y | Y | Y | |||
:visited | B | Y | Y | Y | Y | Y | Y | |||
:active | B | Y | Y | Y | Y | — | — | |||
:hover (CSS Level 2) | — | Y | Y | Y | Y | — | Y | |||
!important | — | Y | Y (Win only) | Y | Y | Y | Y | |||
@import | — | Y | Y | Y | Y | Y | Y |
Key To "Applies to Elements" and "Browser Support" Columns
NN4, NN6 Netscape Navigator 4 and 6 |
OP3.6, OP4.02 Opera 3.6 and 4.02 |
IE4, IE5, IE5.5 Microsoft Internet Explorer 4, 5 and 5.5 |
NOTE : IE 5.5 available onWindows 9x/NT/2000 Only |
Key for: Applies to Elements | Key for: Browser Support Symbols/Keywords | ||
Value | Meaning | Value | Meaning |
A | Applies to all elements | — (long dash) | Not supported |
B | Applies to block-level elements | Y | All values supported |
I | Applies to inline elements | P | Partial support -- some values not supported |
R | Applies to replaced elements | B | Some bugs in implementation |
AP | Applies to absolutely positioned elements | B! | Severe bugs in implementation |
RP | Applies to relatively positioned elements | Mac, Win | Macintosh- or Windows -specific (e.g., (Y Mac) |
Definition of Keywords Used in Property Value Descriptions
User-defined property values (Italicized) | Margin/Padding/Border Shorthand Assignment Rules | ||
Value | Description | Value Assignment | Meaning |
urlstring | A partial or complete URL | property: v1 | All sides given value v1 |
color | A color specified as a named color (see Appendix A), or as an RGB code using the syntax #rrggbb, #rgb, rgb(red,green,blue) or rgb(red%,green%,blue%) | property: v1 v2 v3 | Top given value v1, right given value v2, bottom given value v3, left given value v2 |
length | A length specified in relative (em, ex) or absolute (cm, mm, in, pc, pt, px) length units. Can be a positive or, depending on the property, a negative value. | property: v1 v2 v3 v4 | Top given value v1, right given value v2, bottom given value v3, left given value v4 |
num; num% | A real number; or a percentage (real) length value. | property: v1 v2 | Top and bottom given value v1; right and left given value v2 |
int | A positive or negative integer. |
http://webreview.com/pub/guides/style/style.html | http://www.richinstyle.com/bugs/table.html |
CSS Tips and browsers bug workarounds: |
http://www.iangraham.org/books/xhtml2/exerpt/css-4a.html http://www.css.nu/faq/index.html http://css.nu/pointers/bugs.html |