The CSS background properties are used to add background effects for elements.
In these chapters, you will learn about the following CSS background properties:
background-colorbackground-imagebackground-repeatbackground-attachmentbackground-positionbackground (shorthand property)The background-color property specifies the background color of an element
With CSS, a color is most often specified by:
The background-image property specifies an image to use as the background of an element.
By default, the image is repeated so it covers the entire element
An external style sheet can be written in any text editor, and must be saved with a .css extension.
The external .css file should not contain any HTML tags
By default, the background-image property repeats an image both horizontally and vertically..
Showing the background image only once is also specified by the background-repeat property
The background-position property is used to specify the position of the background image.
The background-attachment property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page)
To shorten the code, it is also possible to specify all the background properties in one single property. This is called a shorthand property.
When using the shorthand property the order of the property values is:
Aenean lorem odio, mollis sed consequat et, pellentesque id purus. Nunc sagittis malesuada urna, ultricies lacinia nisi varius vitae. Aliquam sit amet egestas sapien, nec mollis quam.