blank blank blank
Wellpinit
Wellpinit
spacer Link: Home Page Link: Students and Parents Link: Faculty and Staff Link: Culture Link: District spacer
red
backprinter friendly
Saturday July 26, 2008    7:55 PM
blank
 
CSS I - Cascading Style Sheets
 

a line
Index

a line

Caveats

  • This is a cheat sheet. You will need to know more about many of the codes.
  • A useful book for using CSS, and the best reference book on HTML that I know of, is Jennifer Niederst, Web Design in a Nutshell, 2nd Edition, O'Reilly, 2001
  • Useful on-line resources include:
  • Different browser support CSS in slightly different ways. No browser currenly supports ALL the CSS tags. And no browser currenly supports ALL the attributes of all CSS tags. You must test your code to see how it works in practice.
  • Always test your code on Microsoft's Internet Explorer since nearly 90% of people use IE as their Internet browser.
  • All have a shorthand font. Sometimes the shorthand is better supported.
  • But ALL major commercial Internet sites use CSS to control the appearance of their pages.


a line

Font Properties


up  Font-Family

Syntax: font-family: [[<family-name> | <generic-family>],]* [<family-name> | <generic-family>]
Possible Values: <family-name> or <generic-family>
Initial Value: Browser defaults
Stylesheet Sample:
P { font-family: "New Century Schoolbook", Times, serif }
In-line Sample:
Comments: Any font family name may be used, but any specified font must be installed in the computer. It is therefore good to use several names, as well as a font-family name.

up  Font-Style

Syntax: font-style: <value>
Possible Values: normal | italic | oblique
Initial Value: normal
Sample: A sample style sheet with font-style declarations might look like this: H1 { font-style: oblique } P { font-style: normal }
Comments:  

up  Font-Variant

Syntax: font-variant: <value>
Possible Values: normal | small-caps
Initial Value: normal
Sample: An example of a font-variant assignment would be:
SPAN { font-variant: small-caps }
Comments:  

up  Font-Weight

Syntax: font-weight: <value>
Possible Values: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
Initial Value: normal
Sample: Some example font-weight assignments would be:
H1 { font-weight: 800 }
P { font-weight: normal }
Comments:  

up  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
Sample: Some example size assignments would be:
H1 { font-size: large } P { font-size: 12pt }
LI { font-size: 90% } STRONG { font-size: larger }
Comments: Stick to the basic tags.
Specify an absolute height in points.

up  Font [the shorthand for specifying all the font values in a single command]

Syntax: font: <value>
Possible Values: [ <font-style> || <font-variant> || <font-weight> ]? <font-size> [ / <line-height> ]? <font-family>
Initial Value: Not defined
Stylesheet Sample: 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.
In-line Sample:
Comments: The font property may be used as a shorthand for the various font properties, as well as the line height.


a line

Color and Background Properties


up  Color

Syntax: color: <color>
Initial Value: Determined by browser
Stylesheet Sample:
H1 { color: blue }
H2 { color: #000080 }
H3 { color: #0c0 }
In-line Sample:
Comments: The color property allows authors to specify the color of an element. See the Units section for color value descriptions. To help avoid conflicts with user style sheets, background and color properties should always be specified together.

up  Background Color

Syntax: background-color: <value>
Possible Values: <color> | transparent
Initial Value: transparent
Stylesheet Sample:
BODY { background-color: white }
H1   { background-color: #000080 }
In-line Sample:
Comments: The background-color property sets the background color of an element.
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.

up  Background Image

Syntax: background-image: <value>
Possible Values: <url> | none
Initial Value: none
Stylesheet Sample:
BODY { background-image: url(/graphics/foo.gif) }
P    { background-image: url(http://www.htmlhelp.com/bg.png) }
In-line Sample:
Comments: The background-image property sets the background image of an element.
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.

up  Background Repeat

Syntax: background-repeat: <value>
Possible Values: repeat | repeat-x | repeat-y | no-repeat
Initial Value: repeat
Stylesheet Sample:
BODY { background: white url(candybar.gif);
       background-repeat: repeat-x }
In-line Sample:
Comments: 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.
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.

up  Background Attachment

Syntax: background-attachment: <value>
Possible Values: scroll | fixed
Initial Value: scroll
Stylesheet Sample:
BODY { background: white url(candybar.gif);
       background-attachment: fixed }
In-line Sample:
Comments: The background-attachment property determines if a specified background image will scroll with the content or be fixed with regard to the canvas.
Authors may also use the shorthand background property, which is currently better supported than the background-attachment property.

up  Background Position

Syntax: background-position: <value>
Possible Values: [<percentage> | <length>]{1,2} | [top | center | bottom] || [left | center | right]
Initial Value: 0% 0%
Stylesheet Sample:
In-line Sample:
Comments: 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:
  • Horizontal keywords (left, center, right)
  • Vertical keywords (top, center, bottom)
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:
  • top left = left top = 0% 0%
  • top = top center = center top = 50% 0%
  • right top = top right = 100% 0%
  • left = left center = center left = 0% 50%
  • center = center center = 50% 50%
  • right = right center = center right = 100% 50%
  • bottom left = left bottom = 0% 100%
  • bottom = bottom center = center bottom = 50% 100%
  • bottom right = right bottom = 100% 100%
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.

up  Background

Syntax: background: <value>
Possible Values: <background-color> || <background-image> || <background-repeat> || <background-attachment> || <background-position>
Initial Value: Not defined
Stylesheet Sample:
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 }
In-line Sample:
Comments: The background property is a shorthand for the more specific background-related properties.
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.


a line

Text Properties


up  Word Spacing

Syntax: word-spacing: <value>
Possible Values: normal | <length>
Initial Value: normal
Stylesheet Sample:
P EM   { word-spacing: 0.4em }
P.note { word-spacing: -0.2em }
In-line Sample:
Comments: The word-spacing property defines an additional amount of space between words. The value must be in the length format; negative values are permitted.

up  Letter Spacing

Syntax: letter-spacing: <value>
Possible Values: normal | <length>
Initial Value: normal
Stylesheet Sample:
H1     { letter-spacing: 0.1em }
P.note { letter-spacing: -0.1em }
In-line Sample:
Comments: 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.

up  Text Decoration

Syntax: text-decoration: <value>
Possible Values: none | [ underline || overline || line-through || blink ]
Initial Value: none
Stylesheet Sample: One can suggest that links not be underlined with
A:link, A:visited, A:active { text-decoration: none }
In-line Sample:
Comments: The text-decoration property allows text to be decorated through one of five properties: underline, overline, line-through, blink, or the default, none.

up  Vertical Alignment

Syntax: vertical-align: <value>
Possible Values: baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage>
Initial Value: baseline
Stylesheet Sample: 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 }
In-line Sample:
Comments: 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:
  • baseline (align baselines of element and parent)
  • middle (align vertical midpoint of element with baseline plus half the x-height--the height of the letter "x"--of the parent)
  • sub (subscript)
  • super (superscript)
  • text-top (align tops of element and parent's font)
  • text-bottom (align bottoms of element and parent's font)
The keywords affecting the positioning relative to the element's line are
  • top (align top of element with tallest element on the line)
  • bottom (align bottom of element with lowest element on the line)

up  Text Transformation

Syntax: text-transform: <value>
Possible Values: none | capitalize | uppercase | lowercase
Initial Value: none
Stylesheet Sample:
H1 { text-transform: uppercase }
H2 { text-transform: capitalize }
In-line Sample:
Comments: The text-transform property allows text to be transformed by one of four properties:
  • capitalize (capitalizes first character of each word)
  • uppercase (capitalizes all characters of each word)
  • lowercase (uses small letters for all characters of each word)
  • none (the initial value)
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.

up  Text Alignment

Syntax: text-align: <value>
Possible Values: left | right | center | justify
Initial Value: Determined by browser
Stylesheet Sample:
In-line Sample:
H1          { text-align: center }
P.newspaper { text-align: justify }
Comments: 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.

up  Text Indentation

Syntax: text-indent: <value>
Possible Values: <length> | <percentage>
Initial Value: 0
Stylesheet Sample:
P { text-indent: 5em }
In-line Sample:
Comments: 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.

up  Line Height

Syntax: line-height: <value>
Possible Values: normal | <number> | <length> | <percentage>
Initial Value: normal
Stylesheet Sample:
P { line-height: 200% }
In-line Sample:
Comments: 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.

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.



a line

Box Properties


up  Top Margin

Syntax: margin-top: <value>
Possible Values: <length> | <percentage> | auto
Initial Value: 0
Stylesheet Sample:
BODY { margin-top: 0 }
In-line Sample:
Comments: 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.
Note that adjoining vertical margins are collapsed to use the maximum of the margin values.

up  Right Margin

Syntax: margin-right: <value>
Possible Values: <length> | <percentage> | auto
Initial Value: 0
Stylesheet Sample:
P.narrow { margin-right: 50% }
In-line Sample:
Comments: 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.
Note that adjoining horizontal margins are not collapsed.

up  Bottom Margin

Syntax: margin-bottom: <value>
Possible Values: <length> | <percentage> | auto
Initial Value: 0
Stylesheet Sample:
DT { margin-bottom: 3em }
In-line Sample:
Comments: 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.
Note that adjoining vertical margins are collapsed to use the maximum of the margin values.

up  Left Margin

Syntax: margin-left: <value>
Possible Values: <length> | <percentage> | auto
Initial Value: 0
Stylesheet Sample:
ADDRESS { margin-left: 50% }
In-line Sample:
Comments: 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.
Note that adjoining horizontal margins are not collapsed.

up  Margin

Syntax: margin: <value>
Possible Values: [ <length> | <percentage> | auto ]{1,4}
Initial Value: Not defined
Stylesheet Sample:
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 */
In-line Sample:
Comments: 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.
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.

up  Top Padding

Syntax: padding-top: <value>
Possible Values: <length> | <percentage>
Initial Value: 0
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Right Padding

Syntax: padding-right: <value>
Possible Values: <length> | <percentage>
Initial Value: 0
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Bottom Padding

Syntax: padding-bottom: <value>
Possible Values: <length> | <percentage>
Initial Value: 0
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Left Padding

Syntax: padding-left: <value>
Possible Values: <length> | <percentage>
Initial Value: 0
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Padding

Syntax: padding: <value>
Possible Values: [ <length> | <percentage> ]{1,4}
Initial Value: 0
Stylesheet Sample: 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 }
In-line Sample:
Comments: 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.

up  Top Border Width

Syntax: border-top-width: <value>
Possible Values: thin | medium | thick | <length>
Initial Value: medium
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Right Border Width

Syntax: border-right-width: <value>
Possible Values: thin | medium | thick | <length>
Initial Value: medium
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Bottom Border Width

Syntax: border-bottom-width: <value>
Possible Values: thin | medium | thick | <length>
Initial Value: medium
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Left Border Width

Syntax: border-left-width: <value>
Possible Values: thin | medium | thick | <length>
Initial Value: medium
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Border Width

Syntax: border-width: <value>
Possible Values: [ thin | medium | thick | <length> ]{1,4}
Initial Value: Not defined
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Border Color

Syntax: border-color: <value>
Possible Values: <color>{1,4}
Initial Value: The value of the color property.
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Border Style

Syntax: border-style: <value>
Possible Values: [ none | dotted | dashed | solid | double | groove | ridge | inset | outset ]{1,4}
Initial Value: none
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Top Border

Syntax: border-top: <value>
Possible Values: <border-top-width> || <border-style> || <color>
Initial Value: Not defined
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Right Border

Syntax: border-right: <value>
Possible Values: <border-right-width> || <border-style> || <color>
Initial Value: Not defined
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Bottom Border

Syntax: border-bottom: <value>
Possible Values: <border-bottom-width> || <border-style> || <color>
Initial Value: Not defined
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Left Border

Syntax: border-left: <value>
Possible Values: <border-left-width> || <border-style> || <color>
Initial Value: Not defined
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Border

Syntax: border: <value>
Possible Values: <border-width> || <border-style> || <color>
Initial Value: Not defined
Stylesheet Sample:
H2        { border: groove 3em }
A:link    { border: solid blue }
A:visited { border: thin dotted #800080 }
A:active  { border: thick double red }
In-line Sample:
Comments: The border property is a shorthand for setting the width, style, and color of an element's border.
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.

up  Width

Syntax: width: <value>
Possible Values: <length> | <percentage> | auto
Initial Value: auto
Stylesheet Sample: This property could be used to give common widths to some INPUT elements, such as submit and reset buttons:
INPUT.button { width: 10em }
In-line Sample:
Comments: 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.

up  Height

Syntax: height: <value>
Possible Values: <length> | auto
Initial Value: auto
Stylesheet Sample: As with the width property, height can be used to scale an image:
IMG.foo { width: 40px; height: 40px }
In-line Sample:
Comments: 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.
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.

up  Float

Syntax: float: <value>
Possible Values: left | right | none
Initial Value: none
Stylesheet Sample:
In-line Sample:
Comments: 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.

up  Clear

Syntax: clear: <value>
Possible Values: none | left | right | both
Initial Value: none
Stylesheet Sample:
In-line Sample:
Comments: 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.


a line

Classification Properties


up  Display

Syntax: display: <value>
Possible Values: block | inline | list-item | none
Initial Value: block
Stylesheet Sample:
In-line Sample:
Comments: The display property is used to define an element with one of four values:
  • block (a line break before and after the element)
  • inline (no line break before and after the element)
  • list-item (same as block except a list-item marker is added)
  • none (no display)

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!

up  Whitespace

Syntax: white-space: <value>
Possible Values: normal | pre | nowrap
Initial Value: normal
Stylesheet Sample:
In-line Sample:
Comments: The white-space property will determine how spaces within the element are treated. This property takes one of three values:
  • normal (collapses multiple spaces into one)
  • pre (does not collapse multiple spaces)
  • nowrap (does not allow line wrapping without a <BR> tag)

up  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
Stylesheet Sample:
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. */
In-line Sample:
Comments: 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.

up  List Style Image

Syntax: list-style-image: <value>
Possible Values: <url> | none
Initial Value: none
Stylesheet Sample:
UL.check { list-style-image: url(/LI-markers/checkmark.gif) }
UL LI.x  { list-style-image: url(x.png) }
In-line Sample:
Comments: 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.

up  List Style Position

Syntax: list-style-position: <value>
Possible Values: inside | outside
Initial Value: outside
Stylesheet Sample:
Outside rendering:
 * List item 1
   second line of list item

Inside rendering:
   * List item 1
   second line of list item
In-line Sample:
Comments: 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.

up  List Style

Syntax: list-style: <value>
Possible Values: <list-style-type> || <list-style-position> || <url>
Initial Value: Not defined
Stylesheet Sample:
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 }
In-line Sample:
Comments: The list-style property is a shorthand for the list-style-type, list-style-position, and list-style-image properties.


a line

Units


a line

up  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:
  • em (ems, the height of the element's font)
  • ex (x-height, the height of the letter "x")
  • px (pixels, relative to the canvas resolution)

Absolute length units are highly dependent on the output medium, and so are less useful than relative units. The following absolute units are available:
  • in (inches; 1in=2.54cm)
  • cm (centimeters; 1cm=10mm)
  • mm (millimeters)
  • pt (points; 1pt=1/72in)
  • pc (picas; 1pc=12pt)


a line

up  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.



a line

up  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:
  • #rrggbb (e.g., #00cc00)
  • #rgb (e.g., #0c0)
  • rgb(x,x,x) where x is an integer between 0 and 255 inclusive (e.g., rgb(0,204,0))
  • rgb(y%,y%,y%) where y is a number between 0.0 and 100.0 inclusive (e.g., rgb(0%,80%,0%))
The examples above all specify the same color.

I have two RGB color resources on this web site: the 216 web-safe colors and the 140 Netscape color names. Many other color resources are available on the Web.



a line

up  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.
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 */








Last Updated
12/12/2004
backtop


line
The Wellpinit School District serves ALL students on the Spokane Indian Reservation.
Our student body of 570 enjoys one of the most technologically advanced schools in Eastern Washington.
We take pride in keeping our students up to date with the latest advancements in education and technology.
line
6270 Ford-Wellpinit Road, Wellpinit WA 99040 (509) 258-4535
This website is currently maintained by Magne Kristiansen | Privacy Policy | Copyright 1996-2008
blank