CSS Style Ref

Properties

Font Color and Background Text
Font
Font Family
Font Style
Font Variant
Font Weight
Font Size
Color
Background Color
Background Image
Background Repeat
Background Attachment
Background Position
Background
First Letter
First Line
Word Spacing
Letter Spacing
Text Decoration
Vertical Alignment
Text Transformation
Text Alignment
Text Indentation
Line Height
Box & Units Classification Filters
Width  
Height  
Border Color  
Border Style  
Margin
Padding
Border
Border Width


Units
Length Units
Percentage Units
Color Units
URLs
Display
Whitespace
List Style Type
List Style Image
List Style Position
List Style


Clip
Clear
Cursor
Float
Overflow
Page-Break
Scrollbar
Time2
Visibility
WritingMode
Z-Index
Zoom

Alpha  
Blur  
Chroma  
DropShadow  
FlipH  
FlipV  
Glow  
Gray  
Invert  
Mask  
Shadow  
Wave  
Xray  

Overview

Colour

Used to set the properties of the foreground and background colour of elements on the page. Regardless of how you specify the colour, your viewer might see a different shade of colour depending on their browser and OS. To specify the RGB value of a colour, you can use one of the following three methods:

Content

The content properties is a collection of properties that define how text and other objects appear on the page.

Fonts

With the font properties, you can set the family and any attributes for the fonts used for the various text elements on the page.

absolute value

A measurement using a scale such as points, inches, or centimeters; the opposite of a relative value.

attribute

A parameter that can be added to an HTML tag to alter or enhance its purpose. For example, the WIDTH= attribute can be added to the <HR> to specify the length of a horizontal rule, in the form <HR WIDTH=50%>.

block element

An HTML element that is automatically preceded and followed by a line feed in the client browser (for example, <P> or <H1>); opposite of an inline element.

class selector

A means to isolate specific HTML tags for the application of styles by the addition of the CLASS= attribute.

contextual selector

A means to isolate specific HTML tags for the application of styles by specifying their exact location in relation to other HTML tags.

declaration

Part of a style rule consisting of a property and its associated value.

element

The part of a document that is enclosed between any pair of opening and closing HTML tags.

em

A unit of length corresponding to the width of a font’s capital M at whatever size it is displayed.

hanging indent

A text formatting expression defining a case when the first line of a block of text is extended to the left, beyond the rest of the paragraph.

hexadecimal

A counting system that uses 16 digits, traditionally notated as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

inline element

An HTML element that does not cause the addition of preceding and following line feeds in the client browser (for example, <B> or <I>); opposite of a block element.

justification

The alignment of text in relation to the left and right margins containing it.

kerning

The adjustment of the white space left between specific pairs of letters to account for the architectural design of the typeface.

leading

The white space between an element’s lines of text.

point

A unit of measurement used in printing and publishing equal to 1/72 inch.

property

Part of a style that is used to define a particular aspect of an element’s appearance or location.

pseudo-class

A means of selecting certain text in an HTML document, based not on the HTML code of the document itself, but on other external conditions applied by the web browser.

pseudo-element

A term used to identify a portion of another element according to the way it is displayed by a particular web browser configuration.

relative value

A measurement that is based on a comparison to another measurement, such as a percentage; opposite of absolute value.

rule

Part of a style sheet consisting of a selector and one or more declarations.

selector

Part of a rule indicating the element(s) to which the style should be applied.

style

A collection of properties and their values that are used to modify the appearance or location of HTML elements on a web page.

tracking

The amount of white space left between letters and words in a block of text.

value

A declaration of the specific way in which a property is to be applied to the selected element(s).

white space

Any part of a document not covered by images or text (whether or not the background of the page is actually white).


Font Properties

Font

Syntax: font: <value>
Possible Values: [ <font-style> || <font-variant> || <font-weight> ]? <font-size> [ / <line-height> ]? <font-family>
Initial Value: Not defined
Applies to: All elements
Inherited: Yes

The font property may be used as a shorthand for the various font properties, as well as the line height.
For example:

P { font: italic bold 12pt/14pt Times, serif }

specifies paragraphs with a bold and italic Times or serif font with a size of 12 points and a line height of 14 points.


font-family

Syntax: font-family: [[<family-name> | <generic-family>],]* [<family-name> | <generic-family>]
Possible Values: <family-name>
  • Any font family name may be used
<generic-family>
  • serif (e.g., Times)
  • sans-serif (e.g., Arial or Helvetica)
  • cursive (e.g., Zapf-Chancery)
  • fantasy (e.g., Western)
  • monospace (e.g., Courier)
Initial Value: Determined by browser
Applies to: All elements
Inherited: Yes

Font families may be assigned by a specific font name or a generic font family. Obviously, defining a specific font will not be as likely to match as a generic font family. Multiple family assignments can be made, and if a specific font assignment is made it should be followed by a generic family name in case the first choice is not present.

A sample font-family declaration might look like this:

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

Notice that the first two assignments are specific type faces: New Century Schoolbook and Times. However, since both of them are serif fonts, the generic font family is listed as a backup in case the system does not have either of these but has another serif font which meets the qualifications.

Any font name containing whitespace must be quoted, with either single or double quotes.

The font family may also be given with the font property.


Font Style

Syntax: font-style: <value>
Possible Values: normal | italic | oblique
Initial Value: normal
Applies to: All elements
Inherited: Yes

The font-style property defines that the font be displayed in one of three ways: normal, italic or oblique (slanted). A sample style sheet with font-style declarations might look like this:

H1 { font-style: oblique }
P { font-style: normal }


Font Variant

Syntax: font-variant: <value>
Possible Values: normal | small-caps
Initial Value: normal
Applies to: All elements
Inherited: Yes

The font-variant property determines if the font is to display in normal or small-caps. Small-caps are displayed when all the letters of the word are in capitals with uppercase characters slightly larger than lowercase. Later versions of CSS may support additional variants such as condensed, expanded, small-caps numerals or other custom variants. An example of a font-variant assignment would be:

span { font-variant: small-caps }


Font Weight

Syntax: font-weight: <value>
Possible Values: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
Initial Value: normal
Applies to: All elements
Inherited: Yes

The font-weight property is used to specify the weight of the font. The bolder and lighter values are relative to the inherited font weight, while the other values are absolute font weights.

Note: Since not all fonts have nine possible display weights some of the weights may be grouped together in assignment. If the specified weight is not available, an alternate will be chosen on the following basis:

Some example font-weight assignments would be:

H1 { font-weight: 800 }
P { font-weight: normal }


Font Size

Syntax: font-size: <absolute-size> | <relative-size> | <length> | <percentage>
Possible Values:
  • <absolute-size>
    • xx-small | x-small | small | medium | large | x-large | xx-large
  • <relative-size>
    • larger | smaller
  • <length>
  • <percentage> (in relation to parent element)
Initial Value: medium
Applies to: All elements
Inherited: Yes

The font-size property is used to modify the size of the displayed font. Absolute lengths (using units like pt and in) should be used sparingly due to their weakness in adapting to different browsing environments. Fonts with absolute lengths can very easily be too small or too large for a user.

Some example size assignments would be:

H1{ font-size: large }
P{ font-size: 12pt }
LI{ font-size: 90% }
STRONG { font-size: larger }

Authors should be aware that Microsoft Internet Explorer 3.x incorrectly treats em and ex units as pixels, which can easily make text using these units unreadable. The browser also incorrectly applies percentage values relative to its default font size for the selector, rather than relative to the parent element's font size. This makes rules like

H1 { font-size: 200% }

dangerous in that the size will be twice IE's default font size for level-one headings, rather than twice the parent element's font size. In this case, BODY would most likely be the parent element, and it would likely define a medium font size, whereas the default level-one heading font size imposed by IE would probably be considered xx-large.

Given these bugs, authors should take care in using percentage values for font-size, and should probably avoid em and ex units for this property.


Color and Background Properties

Background

Syntax: background: <value>
Possible Values: <background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position>
Initial Value: Not defined
Applies to: All elements
Inherited: No

The background property is a shorthand for the more specific background-related properties. Some examples of background declarations follow:

BODY { background: white url(http://www.htmlhelp.com/foo.gif) }
BLOCKQUOTE { background: #7fffd4 }
P { background: url(../backgrounds/pawn.png) #f0f8ff fixed }
TABLE { background: #0c0 url(leaves.jpg) no-repeat bottom right }

A value not specified will receive its initial value. For example, in the first three rules above, the background-position property will be set to 0% 0%.

To help avoid conflicts with user style sheets, background and color properties should always be specified together.


Color

Syntax: color: <color>
Initial Value: Determined by browser
Applies to: All elements
Inherited: Yes

The color property allows authors to specify the color of an element. See the Units section for color value descriptions. Some example color rules include:

H1 { color: blue }
H2 { color: #000080 }
H3 { color: #0c0 }

To help avoid conflicts with user style sheets, background and color properties should always be specified together.


Background Color

Syntax: background-color: <value>
Possible Values: <color> | transparent
Initial Value: transparent
Applies to: All elements
Inherited: No

The background-color property sets the background color of an element. For example:

BODY { background-color: white }
H1{ background-color: #000080 }

To help avoid conflicts with user style sheets, background-image should be specified whenever background-color is used. In most cases, background-image: none is suitable.

Authors may also use the shorthand background property, which is currently better supported than the background-color property.


Background Image

Syntax: background-image: <value>
Possible Values: <url> | none
Initial Value: none
Applies to: All elements
Inherited: No

The background-image property sets the background image of an element. For example:

BODY { background-image: url(/images/foo.gif) }
P { background-image: url(http://www.htmlhelp.com/bg.png) }

When a background image is defined, a similar background color should also be defined for those not loading images.

Authors may also use the shorthand background property, which is currently better supported than the background-image property.


Background Repeat

Syntax: background-repeat: <value>
Possible Values: repeat | repeat-x | repeat-y | no-repeat
Initial Value: repeat
Applies to: All elements
Inherited: No

The background-repeat property determines how a specified background image is repeated. The repeat-x value will repeat the image horizontally while the repeat-y value will repeat the image vertically.
For example:

BODY { background: white url(candybar.gif);background-repeat: repeat-x }

In the above example, the image will only be tiled horizontally.

Authors may also use the shorthand background property, which is currently better supported than the background-repeat property.


Background Attachment

Syntax: background-attachment: <value>
Possible Values: scroll | fixed
Initial Value: scroll
Applies to: All elements
Inherited: No

The background-attachment property determines if a specified background image will scroll with the content or be fixed with regard to the canvas. For example, the following specifies a fixed background image:

BODY { background: white url(candybar.gif);background-attachment: fixed }

Authors may also use the shorthand background property, which is currently better supported than the background-attachment property.


Background Position

Syntax: background-position: <value>
Possible Values: [<percentage> | <length>]{1,2} | [top | center | bottom] || [left | center | right]
Initial Value: 0% 0%
Applies to: Block-level and replaced elements
Inherited: No

The background-position property gives the initial position of a specified background image. This property may only be applied to block-level elements and replaced elements. (A replaced element is one for which only the intrinsic dimensions are known; HTML replaced elements include IMG, INPUT, TEXTAREA, SELECT, and OBJECT.)

The easiest way to assign a background position is with keywords:

Percentages and lengths may also be used to assign the position of the background image. Percentages are relative to the size of the element. Although lengths are allowed, they are not recommended due to their inherent weakness in dealing with differing display resolutions.

When using percentages or lengths, the horizontal position is specified first, followed by the vertical position. A value such as 20% 65% specifies that the point 20% across and 65% down the image be placed at the point 20% across and 65% down the element. A value such as 5px 10px specifies that the upper left corner of the image be placed 5 pixels to the right of and 10 pixels below the upper left corner of the element.

If only the horizontal value is given, the vertical position will be 50%. Combinations of lengths and percentages are allowed, as are negative positions. For example, 10% -2cm is permitted. However, percentages and lengths cannot be combined with keywords.

The keywords are interpreted as follows:

If the background image is fixed with regard to the canvas, the image is placed relative to the canvas instead of the element.

Authors may also use the shorthand background property, which is currently better supported than the background-position property.


Text Properties

First Letter

Defines the first letter style. Cannot be used inline.
Syntax: selector :first-letter {property: value}
Possible Properties: font properties | color properties | background properties | margin properties | padding properties | border properties | text-decoration | vertical-align (only if 'float' is 'none') | text-transform | line-height | float | clear
Initial Value: none
Applies to:
Inherited:

The First Letter pseudo selector applies a custom style to the first letter of the first word.

selector:first-letter {property: value}

First Line

Defines the first line style. Cannot be used inline.
Syntax: selector :first-line {property: value}
Possible Properties: font properties | color properties | background properties | word-spacing | letter-spacing | text-decoration | vertical-align | text-transform | line-height | clear |
Initial Value: none
Applies to:
Inherited:

The First Line pseudo selector applies a custom style to the first line of text that it is assigned to.

selector:first-line {property: value}

Word Spacing

Syntax: word-spacing: <value>
Possible Values: normal | <length>
Initial Value: normal
Applies to: All elements
Inherited: Yes

The word-spacing property defines an additional amount of space between words. The value must be in the length format; negative values are permitted.

Examples:

P EM { word-spacing: 0.4em }
P.note { word-spacing: -0.2em }


Letter Spacing

Syntax: letter-spacing: <value>
Possible Values: normal | <length>
Initial Value: normal
Applies to: All elements
Inherited: Yes

The letter-spacing property defines an additional amount of space between characters. The value must be in the length format; negative values are permitted. A setting of 0 will prevent justification.

Examples:

H1 { letter-spacing: 0.1em }
P.note { letter-spacing: -0.1em }


Text Decoration

Syntax: text-decoration: <value>
Possible Values: none | [ underline || overline || line-through || blink ]
Initial Value: none
Applies to: All elements
Inherited: No

The text-decoration property allows text to be decorated through one of five properties: underline, overline, line-through, blink, or the default, none.

For example, one can suggest that links not be underlined with A:link, A:visited, A:active { text-decoration: none }


Vertical Alignment

Syntax: vertical-align: <value>
Possible Values: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage>
Initial Value: baseline
Applies to: Inline elements
Inherited: No

The vertical-align property may be used to alter the vertical positioning of an inline element, relative to its parent element or to the element's line. (An inline element is one which has no line break before and after it, for example, EM, A, and IMG in HTML.)

The value may be a percentage relative to the element's line-height property, which would raise the element's baseline the specified amount above the parent's baseline. Negative values are permitted.

The value may also be a keyword. The following keywords affect the positioning relative to the parent element:

The keywords affecting the positioning relative to the element's line are

The vertical-align property is particularly useful for aligning images. Some examples follow:

IMG.middle { vertical-align: middle }
IMG { vertical-align: 50% }
.exponent { vertical-align: super }


Text Transformation

Syntax: text-transform: <value>
Possible Values: none | capitalize | uppercase | lowercase
Initial Value: none
Applies to: All elements
Inherited: Yes

The text-transform property allows text to be transformed by one of four properties:

Examples:

H1 { text-transform: uppercase }H2 { text-transform: capitalize }

The text-transform property should only be used to express a stylistic desire. It would be inappropriate, for example, to use text-transform to capitalize a list of countries or names.


Text Alignment

Syntax: text-align: <value>
Possible Values: left | right | center | justify
Initial Value: Determined by browser
Applies to: Block-level elements
Inherited: Yes

The text-align property can be applied to block-level elements (P, H1, etc.) to give the alignment of the element's text. This property is similar in function to HTML's ALIGN attribute on paragraphs, headings, and divisions.

Some examples follow:

H1{ text-align: center }
P.newspaper { text-align: justify }


Text Indentation

Syntax: text-indent: <value>
Possible Values: <length> | <percentage>
Initial Value: 0
Applies to: Block-level elements
Inherited: Yes

The text-indent property can be applied to block-level elements (P, H1, etc.) to define the amount of indentation that the first line of the element should receive. The value must be a length or a percentage; percentages refer to the parent element's width. A common use of text-indent would be to indent a paragraph: P { text-indent: 5em }


Line Height

Syntax: line-height: <value>
Possible Values: normal | <number> | <length> | <percentage>
Initial Value: normal
Applies to: All elements
Inherited: Yes

The line-height property will accept a value to control the spacing between baselines of text. When the value is a number, the line height is calculated by multiplying the element's font size by the number. Percentage values are relative to the element's font size. Negative values are not permitted.

Line height may also be given in the font property along with a font size.

The line-height property could be used to double space text:

P { line-height: 200% }

Microsoft Internet Explorer 3.x incorrectly treats number values and values with em or ex units as pixel values. This bug can easily make pages unreadable, and so authors should avoid provoking it wherever possible; percentage units are often a good choice.


Box Properties

  • Padding
  • Top Padding
  • Right Padding
  • Bottom Padding
  • Left Padding
  • Border
  • Top Border Width
  • Right Border Width
  • Bottom Border Width
  • Left Border Width
  • Border Width
  • Border Color
  • Border Style
  • Top Border
  • Right Border
  • Bottom Border
  • Left Border
  • Width
  • Height
  • Float
  • Clear
  • Margin

    Syntax: margin: <value>
    Possible Values: [ <length> | <percentage> | auto ]{1,4}
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The margin property sets the margins of an element by specifying between one and four values, where each value is a length, a percentage, or auto. Percentage values refer to the parent element's width. Negative margins are permitted.

    If four values are given, they apply to top, right, bottom, and left margin, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

    Examples of margin declarations include:

    BODY { margin: 5em } /* all margins 5em */
    P { margin: 2em 4em } /* top and bottom margins 2em, left and right margins 4em */
    DIV { margin: 1em 2em 3em 4em } /* top margin 1em, right margin 2em, bottom margin 3em, left margin 4em */

    Note that adjoining vertical margins are collapsed to use the maximum of the margin values. Horizontal margins are not collapsed.

    Using the margin property allows one to set all margins; alternatively, the properties margin-top, margin-bottom, margin-left, and margin-right may be used.


    Top Margin

    Syntax: margin-top: <value>
    Possible Values: <length> | <percentage> | auto
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The margin-top property sets the top margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted.

    For example, the following rule would eliminate the top margin of a document:

    BODY { margin-top: 0 }

    Note that adjoining vertical margins are collapsed to use the maximum of the margin values.


    Right Margin

    Syntax: margin-right: <value>
    Possible Values: <length> | <percentage> | auto
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The margin-right property sets the right margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted.

    Example:

    P.narrow { margin-right: 50% }

    Note that adjoining horizontal margins are not collapsed.


    Bottom Margin

    Syntax: margin-bottom: <value>
    Possible Values: <length> | <percentage> | auto
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The margin-bottom property sets the bottom margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted.

    Example:

    DT { margin-bottom: 3em }

    Note that adjoining vertical margins are collapsed to use the maximum of the margin values.


    Left Margin

    Syntax: margin-left: <value>
    Possible Values: <length> | <percentage> | auto
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The margin-left property sets the left margin of an element by specifying a length or a percentage. Percentage values refer to the parent element's width. Negative margins are permitted.

    Example:

    ADDRESS { margin-left: 50% }

    Note that adjoining horizontal margins are not collapsed.


    Padding

    Syntax: padding: <value>
    Possible Values: [ <length> | <percentage> ]{1,4}
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The padding property is a shorthand for the padding-top, padding-right, padding-bottom, and padding-left properties.

    An element's padding is the amount of space between the border and the content of the element. Between one and four values are given, where each value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted.

    If four values are given, they apply to top, right, bottom, and left padding, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

    For example, the following rule sets the top padding to 2em, the right padding to 4em, the bottom padding to 5em, and the left padding to 4em:

    BLOCKQUOTE { padding: 2em 4em 5em }


    Top Padding

    Syntax: padding-top: <value>
    Possible Values: <length> | <percentage>
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The padding-top property describes how much space to put between the top border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted.


    Right Padding

    Syntax: padding-right: <value>
    Possible Values: <length> | <percentage>
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The padding-right property describes how much space to put between the right border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted.


    Bottom Padding

    Syntax: padding-bottom: <value>
    Possible Values: <length> | <percentage>
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The padding-bottom property describes how much space to put between the bottom border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted.


    Left Padding

    Syntax: padding-left: <value>
    Possible Values: <length> | <percentage>
    Initial Value: 0
    Applies to: All elements
    Inherited: No

    The padding-left property describes how much space to put between the left border and the content of the selector. The value is either a length or a percentage. Percentage values refer to the parent element's width. Negative values are not permitted.


    Border

    Syntax: border: <value>
    Possible Values: <border-width> || <border-style> || <color>
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The border property is a shorthand for setting the width, style, and color of an element's border.

    Examples of border declarations include:

    H2        { border: groove 3em }
    A:link    { border: solid blue }
    A:visited { border: thin dotted #800080 }
    A:active  { border: thick double red }

    The border property can only set all four borders; only one border width and border style may be given. To give different values to an element's four borders, an author must use one or more of the border-top, border-right, border-bottom, border-left, border-color, border-width, border-style, border-top-width, border-right-width, border-bottom-width, or border-left-width properties.


    Top Border Width

    Syntax: border-top-width: <value>
    Possible Values: thin | medium | thick | <length>
    Initial Value: medium
    Applies to: All elements
    Inherited: No

    The border-top-width property is used to specify the width of an element's top border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed.

    One may also use the border-top, border-width, or border shorthand properties.


    Right Border Width

    Syntax: border-right-width: <value>
    Possible Values: thin | medium | thick | <length>
    Initial Value: medium
    Applies to: All elements
    Inherited: No

    The border-right-width property is used to specify the width of an element's right border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed.

    One may also use the border-right, border-width, or border shorthand properties.


    Bottom Border Width

    Syntax: border-bottom-width: <value>
    Possible Values: thin | medium | thick | <length>
    Initial Value: medium
    Applies to: All elements
    Inherited: No

    The border-bottom-width property is used to specify the width of an element's bottom border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed.

    One may also use the border-bottom, border-width, or border shorthand properties.


    Left Border Width

    Syntax: border-left-width: <value>
    Possible Values: thin | medium | thick | <length>
    Initial Value: medium
    Applies to: All elements
    Inherited: No

    The border-left-width property is used to specify the width of an element's left border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths. Negative values are not allowed.

    One may also use the border-left, border-width, or border shorthand properties.


    Border Width

    Syntax: border-width: <value>
    Possible Values: [ thin | medium | thick | <length> ]{1,4}
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The border-width property is used to set the border width of an element by specifying between one and four values, where each value is a keyword or a length. Negative lengths are not permitted.

    If four values are given, they apply to top, right, bottom, and left border width, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

    This property is a shorthand for the border-top-width, border-right-width, border-bottom-width, and border-left-width properties.

    One may also use the border shorthand property.


    Border Color

    Syntax: border-color: <value>
    Possible Values: <color>{1,4}
    Initial Value: The value of the color property
    Applies to: All elements
    Inherited: No

    The border-color property sets the color of an element's border. Between one and four color values are specified. If four values are given, they apply to top, right, bottom, and left border color, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

    One may also use the border shorthand property.


    Border Style

    Syntax: border-style: <value>
    Possible Values: [ none | dotted | dashed | solid | double | groove | ridge | inset | outset ]{1,4}
    Initial Value: none
    Applies to: All elements
    Inherited: No

    The border-style property sets the style of an element's border. This property must be specified for the border to be visible.

    Between one and four keywords are specified. If four values are given, they apply to top, right, bottom, and left border style, respectively. If one value is given, it applies to all sides. If two or three values are given, the missing values are taken from the opposite side.

    One may also use the border shorthand property.


    Top Border

    Syntax: border-top: <value>
    Possible Values: <border-top-width> || <border-style> || <color>
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The border-top property is a shorthand for setting the width, style, and color of an element's top border.

    Note that only one border-style value may be given.

    One may also use the border shorthand property.


    Right Border

    Syntax: border-right: <value>
    Possible Values: <border-right-width> || <border-style> || <color>
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The border-right property is a shorthand for setting the width, style, and color of an element's right border.

    Note that only one border-style value may be given.

    One may also use the border shorthand property.


    Bottom Border

    Syntax: border-bottom: <value>
    Possible Values: <border-bottom-width> || <border-style> || <color>
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The border-bottom property is a shorthand for setting the width, style, and color of an element's bottom border.

    Note that only one border-style value may be given.

    One may also use the border shorthand property.


    Left Border

    Syntax: border-left: <value>
    Possible Values: <border-left-width> || <border-style> || <color>
    Initial Value: Not defined
    Applies to: All elements
    Inherited: No

    The border-left property is a shorthand for setting the width, style, and color of an element's left border.

    Note that only one border-style value may be given.

    One may also use the border shorthand property.


    Width

    Syntax: width: <value>
    Possible Values: <length> | <percentage> | auto
    Initial Value: auto
    Applies to: Block-level and replaced elements
    Inherited: No

    Each block-level or replaced element can be given a width, specified as a length, a percentage, or as auto. (A replaced element is one for which only the intrinsic dimensions are known; HTML replaced elements include IMG, INPUT, TEXTAREA, SELECT, and OBJECT.) The initial value for the width property is auto, which results in the element's intrinsic width (i.e., the width of the element itself, for example the width of an image). Percentages refer to the parent element's width. Negative values are not allowed.

    This property could be used to give common widths to some INPUT elements, such as submit and reset buttons:

    INPUT.button { width: 10em }


    Height

    Syntax: height: <value>
    Possible Values: <length> | auto
    Initial Value: auto
    Applies to: Block-level and replaced elements
    Inherited: No

    Each block-level or replaced element can be given a height, specified as a length or as auto. (A replaced element is one for which only the intrinsic dimensions are known; HTML replaced elements include IMG, INPUT, TEXTAREA, SELECT, and OBJECT.) The initial value for the height property is auto, which results in the element's intrinsic height (i.e., the height of the element itself, for example the height of an image). Negative lengths are not allowed.

    As with the width property, height can be used to scale an image:

    IMG.foo { width: 40px; height: 40px }

    In most cases, authors are advised to scale the image in an image editing program, since browsers will not likely scale images with high quality, and since scaling down causes the user to download an unnecessarily large file. However, scaling through the width and height properties is a useful option for user-defined style sheets in order to overcome vision problems.


    Float

    Syntax: float: <value>
    Possible Values: left | right | none
    Initial Value: none
    Applies to: All elements
    Inherited: No

    The float property allows authors to wrap text around an element. This is identical in purpose to HTML 3.2's ALIGN=left and ALIGN=right for the IMG element, but CSS1 allows all elements to "float," not just the images and tables that HTML 3.2 allows.

    See Examples


    Clear

    Syntax: clear: <value>
    Possible Values: none | left | right | both
    Initial Value: none
    Applies to: All elements
    Inherited: No

    The clear property specifies if an element allows floating elements to its sides. A value of left moves the element below any floating element on its left; right acts similarly for floating elements on the right. Other values are none, which is the initial value, and both, which moves the element below floating elements on both of its sides. This property is similar in function to HTML 3.2's <BR CLEAR=left|right|all|none>, but it can be applied to all elements.


    Classification Properties

    Display

    Syntax: display: <value>
    Possible Values: block | inline | list-item | none
    Initial Value: block
    Applies to: All elements
    Inherited: No

    The display property is used to define an element with one of four values:

    Each element typically is given a default display value by the browser, based on suggested rendering in the HTML specification.

    The display property can be dangerous because of its ability to display elements in what would otherwise be an improper format. The use of the value none will turn off display of the element to which it is assigned, including any children elements!


    Whitespace

    Syntax: white-space: <value>
    Possible Values: normal | pre | nowrap
    Initial Value: normal
    Applies to: Block-level elements
    Inherited: Yes

    The white-space property will determine how spaces within the element are treated. This property takes one of three values:


    List Style Type

    Syntax: list-style-type: <value>
    Possible Values: disc | circle | square | decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none
    Initial Value: disc
    Applies to: Elements with display value list-item
    Inherited: Yes

    The list-style-type property specifies the type of list-item marker, and is used if list-style-image is none or if image loading is turned off.

    Examples:

    LI.square { list-style-type: square }
    UL.plain { list-style-type: none }
    OL { list-style-type: upper-alpha } /* A B C D E etc. */
    OL OL { list-style-type: decimal } /* 1 2 3 4 5 etc. */
    OL OL OL { list-style-type: lower-roman } /* i ii iii iv v etc. */


    List Style Image

    Syntax: list-style-image: <value>
    Possible Values: <url> | none
    Initial Value: none
    Applies to: Elements with display value list-item
    Inherited: Yes

    The list-style-image property specifies the image that will be used as list-item marker when image loading is turned on, replacing the marker specified in the list-style-type property.

    Examples:

    UL.check { list-style-image: url(/LI-markers/checkmark.gif) }
    UL LI.x { list-style-image: url(x.png) }


    List Style Position

    Syntax: list-style-position: <value>
    Possible Values: inside | outside
    Initial Value: outside
    Applies to: Elements with display value list-item
    Inherited: Yes

    The list-style-position property takes the value inside or outside, with outside being the default. This property determines where the marker is placed in regard to the list item. If the value inside is used, the lines will wrap under the marker instead of being indented. An example rendering is:

    Outside rendering: * List item 1 second line of list item
    Inside rendering: * List item 1second line of list item


    List Style

    Syntax: list-style: <value>
    Possible Values: <list-style-type> || <list-style-position> || <url>
    Initial Value: Not defined
    Applies to: Elements with display value list-item
    Inherited: Yes

    The list-style property is a shorthand for the list-style-type, list-style-position, and list-style-image properties.

    Examples:

    LI.square { list-style: square inside }
    UL.plain { list-style: none }
    UL.check { list-style: url(/LI-markers/checkmark.gif) circle }
    OL { list-style: upper-alpha }
    OL OL { list-style: lower-roman inside }


    Units

    Length Units

    A length value is formed by an optional + or -, followed by a number, followed by a two-letter abbreviation that indicates the unit. There are no spaces in a length value; e.g., 1.3 em is not a valid length value, but 1.3em is valid. A length of 0 does not require the two-letter unit identifier.

    Both relative and absolute length units are supported in CSS1. Relative units give a length relative to another length property, and are preferred since they will better adjust to different media. The following relative units are available:

    Absolute length units are highly dependent on the output medium, and so are less useful than relative units. The following absolute units are available:


    Percentage Units

    A percentage value is formed by an optional + or -, followed by a number, followed by %. There are no spaces in a percentage value.

    Percentage values are relative to other values, as defined for each property. Most often the percentage value is relative to the element's font size.


    Color Units

    A color value is a keyword or a numerical RGB specification.

    The 16 keywords are taken from the Windows VGA palette: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

    RGB colors are given in one of four ways:

    The examples above all specify the same color.

    For a more detailed colour chart see Colours


    URLs

    A URL value is given by url(foo), where foo is the URL. The URL may be optionally quoted with either single (') or double (") quotes and may contain whitespace before or after the (optionally quoted) URL.

    Parentheses, commas, spaces, single quotes, or double quotes in the URL must be escaped with a backslash. Partial URLs are interpreted relative to the style sheet source, not to the HTML source.

    Note that Netscape Navigator 4.x incorrectly interprets partial URLs relative to the HTML source. Given this bug, authors may wish to use full URLs where possible.

    Examples:

    BODY { background: url(stripe.gif) }
    BODY { background: url(http://www.htmlhelp.com/stripe.gif) }
    BODY { background: url( stripe.gif ) }
    BODY { background: url("stripe.gif") }
    BODY { background: url(\"Ulalume\".png) } /* quotes in URL escaped */s

    Z-Index

    If the order of your layers is not exactly how you planned, then you can use the z-index attribute to correct them.

    1. z-index:0   First layer
    2. z-index:1   Second layer
    3. z-index:2   Third layer
    <p style="position:absolute; top:200px;left:10px; font-size:80pt; color:ffffff; text-align:left; width:50px; line-height:150%; letter-spacing:5px; z-index:0">Your Layer 1

    See Layers

    Clip

    Syntax:
    Value:

    Initial Value:



    Applies to:
    Inherited:

    clip(top,right,bottom,left)
    clip.top clip.right clip.bottom clip.left clip.width clip.height

    Each dimension of the clipping coordinates is its own property, as seen here.
    Changing any property immediately causes the on-screen clip to change.
    Example:
    document.all.blockname.style.clip ="rect(0 25 25 0)"

    Specifies a rectangular portion of the block which is visible. Typically, you use the clip property if you want to show only a portion of the block, therefore hiding a portion.

    MSIE: clip:rect(top right bottom left)
    Example: "clip:rect(0px 30px 50px 0px);"

    Netscape: clip:rect(left,top,right,bottom)
    Example: "clip:rect(0,0,30,50);"

    Cursor

    Syntax:
    Value:

    Initial Value:
    Applies to:
    Inherited:

    cursor <value>
    auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize |
    se-resize | sw-resize | s-resize | w-resize| text | wait | help | url(file.cur) | url(file.ani)
    auto
    all elements
    yes

    See Cursor Tricks

    Overflow-x, Overflow-y

    Sets or retrieves how to manage the content of the object when the content exceeds the height of the object

    Syntax
    Values

     

     

    Initial Value:
    Inherited

    overflow-x : || overflow-y : <value>
    visible Content is not clipped and scroll bars are not added. Elements are clipped to the size of the containing window or frame.
    scroll Content is clipped and scroll bars are added, even if the content does not exceed the dimensions of the object.
    hidden. Content that exceeds the dimensions of the object is not shown.
    auto Content is clipped and scrolling is added only when necessary.
    visible
    No

    Page-Break

    Scripting - object.style.pageBreakBefore [ = value ]

    Can be used with any HTML tag

    Example

    <style>
    .break{page-break-before:always}
    </style>

    <P class="break">This is where the break will occur
    Syntaxpage-break-before:value | page-Break-After:value
    Values:
    always
    auto
    ""

    Always insert a page break before the object.
    Default. Neither force nor forbid a page break before the object.
    empty string - Do not insert a page break.

    Scrollbar

    Syntax: scrollbar <-value-color>
    Possible Values: -arrow- | -base- | -3d-light- | -darkshadow- | -lightshadow- | -face- |
    Initial Value: None
    Applies to: Scrollbars
    Inherited: No

    Visibility

    Syntax: visibility: <value>
    Possible Values: visible | hidden
    Initial Value: None
    Applies to: All Elements
    Inherited:

    WritingMode

    Syntax: writing-Mode <value>
    Click once within this box to rotate me
    Possible Values: lr-tb | tb-rl
    Initial Value: None
    Applies to: All Elements
    Inherited:

    lr-tb Content flows from left to right and from top to bottom. The next horizontal line will be placed underneath the current one. All glyphs are positioned upright. The default.

    tb-rl Content flows from top to bottom and from right to left. The next vertical line is positioned to the left of the current line. Wide-cell glyphs are positioned upright; nonwide-cell glyphs are rotated 90-degrees clockwise.

    Time2

    Syntax: behavior: url(#default#time2) <value>
    Possible Values: BEGIN="seconds" | DUR="seconds"
    Initial Value: None
    Applies to: Text and Images
    Inherited: No

    Zoom

    Syntax: zoom: <value>
    Possible Values: number
    Initial Value: None
    Applies to: Text and Images
    Inherited: No

    Filter

    Syntax: filter <value>
    Possible Values: Alpha | Blur | Chroma | DropShadow | FlipH | FlipV | Glow | Gray | Invert | Mask | Shadow | Wave | X-ray
    Initial Value: None
    Applies to: Text and/or Images
    Inherited: No
    See Filters for examples

    Alpha(Opacity=starting opacity level, FinishOpacity=finish opacity level, Style=gradient style, StartX=gradient start X position, StartY=gradient starting Y position, FinishX=gradient finishing X position, FinishY=gradient finishing Y position)

    Opacity is the only required value.
    Starting opacity is the uniform opacity level for the filter , 0 through 100, 100 being opaque.
    FinishOpacity for a gradient of the other value it fades to.
    StartX and StartY are the coordinates on the filtered object that the gradient starts at (where it is the opacity value), while FinishX and FinishY are the end points (the FinishOpacity value).
    Style is the type of gradient to use - it accepts a number between 0 and 3, where 0 represents a uniform gradient, 1 a linear gradient, 2 a radial gradient, and 3 a rectangular gradient.
    This effect is most noticeable over a nonsolid background.
    There is a small bug in PR2, so you must have a width and height on a container if you want to apply a filter to its text.

    Blur(Add=add original image, Direction=360-degree direction, Strength=strength of blur)
    Add original object in the blur, 0 (no) 1 (yes).
    Using "0" works better for images, while "1" works better for text.
    Direction is the degree the blur should move off in, 0-360.
    Strength is the distance the blur should go from the source.

    Chroma(Color=Hexadecimal color that will disappear)
    Chroma takes a color that you specify and makes it disappear

    DropShadow(Color=The color of the drop shadow, OffX=pixels Horizontally, OffY=pixels Vertically, Positive=visible or invisible pixels)

    Positive is a Boolean (0 or 1) value;
    "0" = transparent pixels are shadowed
    "1," nontransparent pixels are shadowed.

    FlipH or FlipV
    No arguments. They flip an object on their respective planes (H for horizontal, V for vertical).

    Glow(Color=#nnnnnn, Strength=n)
    Glow surrounds the visible pixels of an object with a gradient-like radiance of a color and strength.

    Gray
    No arguments.

    Invert
    No arguments.

    Mask(Color=Color of the mask)
    This filter takes the visible pixels and makes them invisible, and the invisible pixels and makes them visible in the color specified.

    Shadow(Color=#nnnnnn, Direction=Degree of the shadow)

    Wave(Add=n, Freq=n, LightStrength=n, Phase=n, Strength=n)
    A sine-wave distortion is applied to the filtered object, and is best used in tandem with a script to animate it.
    Add is a Boolean (0 or 1) expression that determines whether the original image gets mixed back into the final effect.
    Freq (frequency) determines how many "waves" appear in the effect.
    LightStrength effects the lightness and darkness of the sides of the waves.
    Phase changes the shape of the wave and takes a value between 0 and 360.
    Strength determines the amplitude of the wave.
    This filter can only be applied horizontally, which limits its usefulness.

    Xray
    The X-ray filter takes no arguments. It drops all the color information from the image like the gray filter, then inverts it, except for the black or white pixels.


    Syntax Used in Property Definitions

    <Foo>
    Value of type Foo. Common types are discussed in the Units section.
    Foo
    A keyword that must appear literally (though without case sensitivity). Commas and slashes must also appear literally.
    A B C
    A must occur, then B, then C, in that order.
    A | B
    A or B must occur.
    A || B
    A or B or both must occur, in any order.
    [ Foo ]
    Brackets are used to group items together.
    Foo*
    Foo is repeated zero or more times.
    Foo+
    Foo is repeated one or more times.
    Foo?
    Foo is optional.
    Foo{A,B}
    Foo must occur at least A times and at most B times.


    Copyright