HTML Background Image

The attribute in the HTML document is used to specify the background image on a HTML page or a table. You can pass the path of an image as a value of background attribute to set the image of your HTML page or table.

Syntax

Note: The Background attribute is not supported in HTML5. Use the following syntax of CSS:

Examples: The following examples set the background image in different styles:

Example 1: This example uses the background attribute with the body tag for displaying the image as a background of the web page.

Test it Now

Output:

HTML Background Image

Example 2: This example uses the background attribute with the table tag for displaying the image as a background of html table.

Test it Now

Output:

HTML Background Image

Example 3: This example uses the CSS syntax for the background-image property of the style attribute with the body tag.

Test it Now

Output:

HTML Background Image

Example 4: This example uses the CSS syntax for the background-image property in the style attribute with the table tag.

Test it Now

Output:

HTML Background Image

Example 5: This example uses the CSS syntax for the background-repeat and background-size property of the style attribute with the body tag.

Test it Now

Output:

HTML Background Image

Browser Support

Element chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
Background Image Yes Yes Yes Yes Yes

Next TopicHtml Button Type




Contact US

Email:[email protected]

HTML Background Image
10/30