Background Code

This page contains HTML background code. That is, code that defines the way that your website's background is displayed in a web browser.

Here are some examples of applying background code to an HTML document.

The background Property

The quickest way to set your background is to use the CSS background property. This property sets all your background properties at once.

The background property is perfect if you are setting many properties. If you're only setting one or two properties however, you might prefer to use one of the more specific properties such as background-color or background-image. More on those below.

Source CodeResult
HTML background code example

Background Color

If you only want to set your background color, you can use background-color:{color code}, where {color code} is a color name, hex code, or decimal RGB value.

Source CodeResult
HTML background color example

Background Image

You can set a background image on any HTML element by using the background-image property.

Source CodeResult
HTML background image example

More Background Code

Here are more background codes: