References : Style sheets

 | Index | 
 | Block | Background and colours | Borders | Fonts | Lists | Texts | Visual effects | Sound effects | Generated content/automatic numbering | Paged media | Table | User interface | 
 | All properties | 

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
Defines the five properties applicable to a background.
 
CSS1 value[<'background-color'> || <'background-image'> || <'background-repeat'> || <'background-attachment'> || <'background-position'>]
 
CSS2 valueinherit
 
Initial valueNot defined.
 
Applied to All elements.
 
Inherited No.
 
 Top
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 valuescroll | fixed
 
CSS2 valueinherit
 
Initial valuescroll
 
Applied to All elements.
 
Inherited No.
 
 Top
background-color
Defines the background colour of an element.
 
CSS1 value <color> | transparent
 
CSS2 valueinherit
 
Initial valuetransparent
 
Applied to All elements.
 
Inherited No.
 
 Top
background-image
Defines the background image of an element.
 
CSS1 value <uri> | none
 
CSS2 valueinherit
 
Initial valuenone
 
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 valueinherit
 
Initial value0% 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 valuerepeat-x | repeat-y | repeat | no-repeat
 
CSS2 valueinherit
 
Initial valuerepeat
 
Applied to All elements.
 
Inherited No.
 
 Top
color
Describes the foreground colour of an element's text.
 
CSS1 value<color>
 
CSS2 valueinherit
 
Initial valueDepends on the browser.
 
Applied to All elements.
 
Inherited Yes.
 
 Top

 | Index | 
 | Block | Background and colours | Borders | Fonts | Lists | Texts | Visual effects | Sound effects | Generated content/automatic numbering | Paged media | Table | User interface | 
 | All properties |