References : Style sheets
Background and colour properties
HTML enables colour and background properties to be defined for text, links, and also for a more general background in the document head. In the same way, CSS provides similar properties for customising the colours of individual elements. The following properties apply to the foreground and background colours of the Web pages' elements.
background |
background-attachment |
background-color |
background-image |
background-position |
background-repeat |
color
| background-attachment |
|
|
| If a background image is specified, this property indicates whether or not the image will be moved when the document is scrolled. |
| |
| CSS1 value | scroll | fixed |
| |
| CSS2 value | inherit |
| |
| Initial value | scroll |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| background-color |
|
|
| Defines the background colour of an element. |
| |
| CSS1 value | <color> | transparent |
| |
| CSS2 value | inherit |
| |
| Initial value | transparent |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| background-image |
|
|
| Defines the background image of an element. |
| |
| CSS1 value | <uri> | none |
| |
| CSS2 value | inherit |
| |
| Initial value | none |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
| Notes | It is also advisable to define a background colour that will be displayed when the image is not available. |
| |
Top |
|
| background-position |
|
|
| If a background image has been defined, this property specifies its initial position. |
| |
| CSS1 value | [[<percentage> | <length>](1,2) | [top | center | bottom] || [left | center | right]] |
| |
| CSS2 value | inherit |
| |
| Initial value | 0% 0%. |
| |
| Applied to | Block level and replaced elements. |
| |
| Inherited | No. |
| |
Top |
|
| background-repeat |
|
|
| Indicates how the image is repeated if it is not large enough to cover the element's background. |
| |
| CSS1 value | repeat-x | repeat-y | repeat | no-repeat |
| |
| CSS2 value | inherit |
| |
| Initial value | repeat |
| |
| Applied to | All elements. |
| |
| Inherited | No. |
| |
Top |
|
| color |
|
|
| Describes the foreground colour of an element's text. |
| |
| CSS1 value | <color> |
| |
| CSS2 value | inherit |
| |
| Initial value | Depends on the browser. |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
Top |
|