
Sets the style of A elements when the current state of a link is "active". Active means that the user is currently navigating the link. Setting the active pseudo-class is often used in conjunction with setting specific styles for the other states of a link: link, visited, hover. Using pseudo-classes on elements other than the A element has no effect.
Note that the syntax in the following example uses a colon (:) to specify a pseudo-class.
A:active {text-decoration:overline;color:purple}
Sets all background properties at once. This property is a shorthand ("composite") property. Separate properties can be used to specify each of the individual properties, but in many cases it is more convenient to set them in one place using this composite property. Possible values here include all of the possible values for each of the individual properties.
All individual background properties not set by the composite background property will be set to their initial values. For example, the initial value for "background-image" is none. Setting "background: white" is identical to saying "background: white none repeat scroll 0% 0%". So, in addition to setting the background color to white, it will clear any background-image, background-repeat, background-attachment, or background-position that has been previously set.
{ background: background-color || background-image || background-repeat || background-attachment || background-position}
This property does not inherit, but the parent element's background will shine through by default due to the initial transparent value.
The first example below sets the background-color for DIV elements to red and sets all other background properties to their initial values. The second example sets the background for the BODY element to show an image. This image will stay fixed as if it were a watermark on a page. Assuming the image is transparent, the color blue will bleed through.
DIV {background: red} BODY {background: blue url(sample.gif) fixed}
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, IMG, INPUT, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, TEXTAREA, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP
If a background image is specified, the value of background-attachment determines if it is fixed with regard to the canvas or if it scrolls with the content.
{ background-attachment: scroll | fixed}
This attribute works only for the BODY and HTML elements.
This attribute is not inherited.
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, IMG, INPUT, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, TEXTAREA, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP
Sets the background color of an element.
{ background-color: color | transparent}
This attribute is not inherited.
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, IMG, INPUT, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, TEXTAREA, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP
Sets the background image of an element. When setting a background image, one should also set a background color that will be used when the image is unavailable. When the image is available, it is overlaid on top of the background color.
{ background-image: url | none}
This attribute is not inherited.
BODY { background-image: url(marble.gif) } P { background-image: none }
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, INPUT type=button, INPUT type=file, INPUT type=reset, INPUT type=submit, INPUT type=text, INPUT type=image, INPUT type=checkbox, INPUT type=radio, INPUT type=password
If a background image has been specified, the value of background-position specifies its initial position.
{ background-position: [percentage | length]{1,2} | [top | center | bottom] || [left | center | right]}
This attribute is not inherited.
Sets the background image at these x,y coordinates of the object.
{background-position: 20px 40px}Positions the background image at the top vertical position and the center horizontal position.
{background-position: top center}
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, INPUT type=button, INPUT type=file, INPUT type=reset, INPUT type=submit, INPUT type=text, INPUT type=image, INPUT type=checkbox, INPUT type=radio, INPUT type=password
backgroundPosition, backgroundPositionX, backgroundPositionY
Determines how/if the image is repeated, if a background image is specified.
A value of repeat means that the image is repeated both horizontally and vertically. The repeat-x (repeat-y) value makes the image repeat horizontally (vertically), to create a single band of images from one side to the other. With a value of no-repeat, the image is not repeated.
{ background-repeat: repeat | repeat-x | repeat-y | no-repeat}
This attribute is not inherited.
In the following example, the image will only be repeated vertically.
BODY {background: red url(pendant.gif); background-repeat: repeat-y;}
A, ADDRESS, B, BIG, BLOCKQUOTE, BODY, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, DD, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HTML, I, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, S, SAMP, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, INPUT type=button, INPUT type=file, INPUT type=reset, INPUT type=submit, INPUT type=text, INPUT type=image, INPUT type=checkbox, INPUT type=radio, INPUT type=password
Specifies the border to display around the element. The border property is a shorthand (composite) property for setting border width, color, and style for all four sides of an object. If a border-color is not specified, the text color is used. Supported on block and replaced elements only.
All individual border properties not set by the composite border property will be set to their initial values. For example, the initial value for border-width is medium. Setting border: thin is identical to saying border: thin none; the initial value for color picks up the text color if one isn't initially set. So, in addition to setting the border width to thin, it will clear any border-style or border-color that has been previously set.
{ border: border-width || border-style || color}
This attribute is not inherited.
Creates a border for all four sides of the object, where all four sides show a 20 pixel blue border with an inset style. Use the individual properties to control the border for individual sides of the object.
{border: 20px inset blue}
BLOCKQUOTE, BODY, CENTER, DD, DIR, DIV, DL, DT, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HR, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, TABLE, TD, TH, TR, UL, XMP, CAPTION, TEXTAREA, IFRAME, SPAN, IMG, EMBED, OBJECT, INPUT
border-width, border-style, border-color border-right, border-left, border-top, border-bottom
Specifies the bottom border. Values that are not present are set to their initial values. Supported on block and replaced elements only.
{ border-bottom: border-bottom-width || border-style || color}
This attribute is not inherited.
In this example, the border will be a solid green line.
{border-bottom: 20px outset green}
BLOCKQUOTE, BODY, CENTER, DD, DIR, DIV, DL, DT, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HR, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, TABLE, TD, TH, TR, UL, XMP, CAPTION, TEXTAREA, IFRAME, SPAN, IMG, EMBED, OBJECT, INPUT
border-bottom-width, border-bottom-style, border-bottom-color, border, border-top
Sets the color of an element's bottom border. Supported on block and replaced elements only. See the Color Table for a list of supported color values.
{ border-bottom-color: border-color}
This attribute is not inherited.
BLOCKQUOTE, BODY, CENTER, DD, DIR, DIV, DL, DT, FIELDSET, FORM, H1, H2, H3, H4, H5, H6, HR, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, TABLE, TD, TH, TR, UL, XMP, CAPTION, TEXTAREA, IFRAME, SPAN, IMG, EMBED, OBJECT, INPUT
border-top-color, border-left-color, border-right-color, border-color
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.