Style Sheets


Style Sheet Properties

The table below provides a list of all CSS-1 and CSS-2 properties (marked with a superscript 2 ) supported by Internet Explorer 4.0 (this will soon be updated to cover all of CSS-2). Each property is listed by property name, followed by a list of valid values and a sample declaration. The "Applies to" column indicates the HTML element types to which you can assign this property. The "Inherited" column indicates whether the property is inherited by subsequent elements in the document.

The properties have been split up into the following groups:

Go to ContentsFont Properties

These seven properties control typography in the document.

Property Valid Values Sample Usage Applies to Inherited?
font-family [ [ family-name | generic-family ], ]* [ family-name | generic-family ] { font-family: Verdana, MS Sans Serif; } all elements yes
font-style normal | italic { font-style:italic; } all elements yes
font-variant normal | small-caps { font-variant:small-caps: } all elements yes
font-weight normal | bold { font-weight:bold; } all elements yes
font-size [ xx-large | x-large | large | medium | small | x-small | xx-small ] | [ larger | smaller ] | percentage | length { font-size:12pt; } all elements yes
font [ font-style || font-variant || font-weight ] ? font-size [ / line-height ] ? font-family { font: bold 12pt Arial; } all elements yes

When specifying a font family, you should also give an alternative generic font family. This will give the browser an idea as to the sort of type face required in the case when a specified font is not installed on the user's system. The browser will pick the font that it considers most appropriate to the family. Valid generic font families are:

Go to ContentsColor and Background Properties

These seven properties control the color of the text and the background, as well as the placement and properties of an optional background image.

Property Valid Values Sample Usage Applies to Inherited?
color color { color:salmon; } all elements yes
background-color color | transparent { background-color:crimson; } all elements no
background-image url | none { background-image:url(bgWood.jpg); } all elements no
background-repeat repeat | repeat-x | repeat-y | no-repeat { background-repeat:no-repeat; } all elements no
background-attachment scroll | fixed { background-attachment:fixed; } all elements no
background-position [ position | length ] | {1,2} | [ top | center | bottom ] || [ left | center | right ] { background-position: top center;} block-level and replaced elements no
background transparent | color || url || repeat || scroll || position { background: silver url(bgRock.jpg) repeat-y } all elements no

Go to ContentsText Properties

These seven properties control text alignment, spacing, and other formatting, such as underline and case (capitalization).

Property Valid Values Sample Usage Applies to Inherited?
letter-spacing normal | length { letter-spacing:2pt; } all elements yes
text-decoration none | underline | overline | line-through { text-decoration:underline; } all elements no
vertical-align sub | super | { vertical-align:sub; } inline elements no
text-transform capitalize | uppercase | lowercase | none { text-transform:lowercase; } all elements yes
text-align left | right | center | justify { text-align:center; } block-level elements yes
text-indent length | percentage { text-indent:20px; } block-level elements yes
line-height normal | number | length | percentage { line-height:5pt; } all elements yes

Go to ContentsBox Properties

There are 32 box properties that control the formatting of the box associated with block and replaceable elements (as discussed in detail in the W3C CSS1 Recommendation  external link).

Property Valid Values Sample Usage Applies to Inherited?
margin-top length | percentage | auto { margin-top:5px; } block-level and replaced elements no
margin-right length | percentage | auto { margin-right:5px; } block-level and replaced elements no
margin-bottom length | percentage | auto { margin-bottom:1em; } block-level and replaced elements no
margin-left length | percentage | auto { margin-left:5pt; } block-level and replaced elements no
margin length | percentage | auto {1,4} { margin: 10px 5px 10px 5px; } block-level and replaced elements no
padding-top length | percentage { padding-top:10%; } block-level and replaced elements no
padding-right length | percentage { padding-right:15px; } block-level and replaced elements no
padding-bottom length | percentage { padding-bottom:1.2em; } block-level and replaced elements no
padding-left length | percentage { padding-left:10pt; } block-level and replaced elements no
padding length | percentage {1,4} { padding: 10px 10px 10px 15px; } block-level and replaced elements no
border-top-width thin | medium | thick | length { border-top-width:thin; } block-level and replaced elements no
border-right-width thin | medium | thick | length { border-right-width:medium; } block-level and replaced elements no
border-bottom-width thin | medium | thick | length { border-bottom-width:thick; } block-level and replaced elements no
border-left-width thin | medium | thick | length { border-left-width:15px; } block-level and replaced elements no
border-width thin | medium | thick | length {1,4} { border-width: 3px 5px 3px 5px; } block-level and replaced elements no
border-top-color color { border-top-color:navajowhite; } block-level and replaced elements no
border-right-color color { border-right-color:whitesmoke; } block-level and replaced elements no
border-bottom-color color { border-bottom-color:black; } block-level and replaced elements no
border-left-color color { border-left-color:#C0C0C0; } block-level and replaced elements no
border-color color {1,4} { border-color: green red white blue; } block-level and replaced elements no
border-top-style none | solid | double | groove | ridge | inset | outset { border-top-style:solid; } block-level and replaced elements no
border-right-style none | solid | double | groove | ridge | inset | outset { border-right-style:double; } block-level and replaced elements no
border-bottom-style none | solid | double | groove | ridge | inset | outset { border-bottom-style:groove; } block-level and replaced elements no
border-left-style none | solid | double | groove | ridge | inset | outset { border-left-style:none; } block-level and replaced elements no
border-style none | solid | double | groove | ridge | inset | outset { border-style:ridge; } block-level and replaced elements no
border-top border-width | border-style | border-color { border-top: medium outset red; } block-level and replaced elements no
border-right border-width | border-style | border-color { border-right: thick inset maroon; } block-level and replaced elements no
border-bottom border-width | border-style | border-color { border-bottom: 10px ridge gray; } block-level and replaced elements no
border-left border-width | border-style | border-color { border-left: 1px groove red; } block-level and replaced elements no
border border-width | border-style | border-color { border: thin solid blue; } block-level and replaced elements no
float none | left | right { float:none; } DIV, SPAN, and replaced elements no
clear none | left | right | both { clear:left; } all elements no

Each box has a content area (e.g., text, an image, etc.) and optional surrounding padding, border, and margin areas; the size of each area is specified by properties defined in the above table. The following diagram shows how these areas relate and the terminology used to refer to pieces of margin, border, and padding:

Image illustrating the relationship between content, padding, borders, and margins.

The padding, border, and padding can be broken down into left, right, top, and bottom segments (e.g., in the diagram, 'LM' for left margin, 'RM' for right margin, 'TM' for top margin, 'BM' for bottom margin, etc.).

The perimeter of each of the four areas (content, padding, border, and margin) is called an 'edge', so each box has four edges:

content edge or inner edge
The content edge surrounds the element's rendered content.
padding edge
The padding edge surrounds the box padding. If the padding has 0 width, the padding edge is the same as the content edge. The padding edge of a box defines the edges of the containing block established by the box.
border edge
The border edge surrounds the box border. If the padding has 0 width, the border edge is the same as the padding edge.
margin edge or outer edge
The margin edge surrounds the box margin. If the margin has 0 width, the margin edge is the same as the border edge.

Each edge may be broken down into a left, right, top, and bottom edge.

Go to ContentsClassification Properties

These five properties consist of "display" and "list" properties: display indicates whether the element is displayed in the document, and the list- properties control the formatting of HTML lists, such as <UL> and <OL>.

Property Valid Values Sample Usage Applies to Inherited?
display none | block | inline | list-item { display:none; } TABLE, INPUT, TEXTAREA, INPUT type=button, DIV, SPAN, IFRAME, IMG, BODY, MARQUEE, SELECT no
list-style-type disk | circle | square | decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none { list-style-type:upper-alpha; } list-item elements yes
list-style-image url | none { list-style-image:url(icFile.gif); } list-item elements yes
list-style-position inside | outside { list-style-position:inside; } list-item elements yes
list-style keyword || position || url { list-style: square outside url(icFolder.gif); } list-item elements yes

Go to ContentsPositioning Properties

These nine properties provide a powerful level of control over the two- and three-dimensional appearance of elements in the document. CSS positioning merits special coverage both in the Internet Client SDK and in the W3C documents, and is worthy of special study.

Property Valid Values Sample Usage Applies to Inherited?
clip shape | auto { clip:rect(0px 200px 200px 0px); } all elements no
height length | auto { height:200px; } DIV, SPAN and replaced elements no
left length | percentage | auto { left:0px; } absolutely and relatively positioned elements no
overflow visible | hidden | scroll | auto { overflow:scroll; } all elements no
position absolute| relative | static { position:absolute; } all elements no
top length | percentage | auto { top:0px; } absolutely and relatively positioned elements no
visibility visible | hidden | inherit { visibility:visible; } all elements no
width length | percentage | auto { width:80%; } DIV, SPAN and replaced elements no
z-index auto | integer { z-index:-1; } absolutely and relatively positioned elements no

Go to ContentsPrinting Properties

These two properties allow the developer to specify exact locations for page breaks that affect the printing of the document.

Property Valid Values Sample Usage Applies to Inherited?
page-break-before auto | always || left | right { page-break-before:always; } block-level elements no
page-break-after auto | always || left | right { page-break-before:auto; } block-level elements no

Go to ContentsPseudo Classes and Other Properties

This catch-all category includes the cursor property which controls the appearance of the mouse pointer as it passes over the element; the first-letter and first-line properties which allow you to define styles, such as drop capitals for the first letter or line of a block; and four pseudo-classes for the A attribute.

Property Valid Values Sample Usage Applies to Inherited?
cursor2 auto | crosshair | default | hand | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help { cursor:hand; } all elements yes
active, hover2, link, visited n/a a:hover { color:red; } all elements yes
first-letter, first-line n/a p:first-letter { font-size: 3em; float: left;} all elements no



Sizzling HTML Jalfrezi
ContactPurchase
Page Contents
Previous pageJalfrezi ContentsNext page

Click Here!