background-color property
Specifies the color to use for the background of the object.
With the background-color property you can set the background color of an element and you can also set the element's background to transparent.
Transparency is allowed by default for frame elements (frame and iframe) in all commonly used browsers, except in Internet Explorer before version 9.
In Internet Explorer before version 9, use ALLOWTRANSPARENCY attribute to allow a frame element to be transparent.
JavaScript page for this property: backgroundColor. You can find other example(s) there. |
Possible values:
One of the following values:
Color of the background. For the supported color values, see the colors page. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Default. Underlying content will shine through. |
Default: transparent.
Example HTML code 1:
This example illustrates the use of the background-color property:
|
||||
<head> <style> .example { background-color: #FF0000; width: 300px; height: 200px; overflow: scroll; } </style> </head> <body> <div class="example"> Some content ..... <br /> ..... <br /> ..... <br /> Some content ..... <br /> ..... <br /> ..... <br /> Some content ..... <br /> ..... <br /> ..... <br /> Some content ..... <br /> ..... <br /> ..... <br /> </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, b, bdo, big, blink, blockQuote, body, button, caption, center, cite, code, col, colGroup, dd, del, dfn, dir, div, dl, dt, em, fieldSet, font, form, frame, frameSet, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, ol, optGroup, option, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
Related pages:
background
background-attachment
background-image
background-position
background-position-x
background-position-y
background-repeat
background-attachment
background-image
background-position
background-position-x
background-position-y
background-repeat
External links:
background-color (MSDN)
background-color (Mozilla Developer Center)
background-color (Safari Reference Library)
background-color (W3C)
background-color (Mozilla Developer Center)
background-color (Safari Reference Library)
background-color (W3C)
User Contributed Comments