HTML Background Code
Here you can get the HTML background code for setting the background of your web page. For example, you an set the background color or specify a background image.
To set the HTML background, you actually use Cascading Style Sheets (CSS). You can set background properties on any HTML element, plus you can do things like, specify an image's position, whether it should repeat, how it should repeat etc.
Background Color
The background-color
property allows you to set the background color for any HTML element:
This results in:
Background Image
This code sets a background image:
This results in:
Fixed Background Image
You can use the background-attachment
property to fix the position of a background image so that its position is fixed (even if it's containing block scrolls):
This results in:
Shorthand Background Code
There's a quick way of setting all background properties of an HTML object. You can use the CSS background
property to set all the background properties at once:
This results in: