CSS Background
The CSS background properties define the background effects of an element.
Examples
Set the background color
This example demonstrates how to set the background color for an element.
Set an image as the
background
This example demonstrates how to set an image as the background.
How to
repeat a background image
This example demonstrates how to repeat a background image.
How to
repeat a background image only vertically
This example demonstrates how to repeat a background image only vertically.
How to
repeat a background image only horizontally
This example demonstrates how to repeat a background image only horizontally.
How to display a background image only one time
This example demonstrates how to display a background image only one time
How to place the
background image
This example demonstrates how to place the image on the page.
How to position a background image using %
This example demonstrates how to position an image on the page using percent.
How to position a background image using pixels
This example demonstrates how to position an image on the page using pixels.
How to set a fixed
background image
This example demonstrates how to set a fixed background image.
All the background properties
in one declaration
This example demonstrates how to use the shorthand property for setting all of
the background properties in one declaration.
All CSS Background Properties
The number in the "CSS" column indicates in which CSS version
the property is defined (CSS1 or CSS2).
| Property |
Description |
Values |
CSS |
| background |
A shorthand property for setting all background properties in one declaration |
background-color
background-image
background-repeat background-attachment background-position |
1 |
| background-attachment |
Sets whether a background image is fixed or scrolls with the rest of the page |
scroll
fixed |
1 |
| background-color |
Sets the background color of an element |
color-rgb
color-hex
color-name
transparent |
1 |
| background-image |
Sets an image as the background |
url(URL)
none |
1 |
| background-position |
Sets the starting position of a background image |
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
xpos ypos |
1 |
| background-repeat |
Sets if/how a background image will be repeated |
repeat
repeat-x
repeat-y
no-repeat |
1 |
729,913 sites built with Wix. Make your own
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|