Html Body Tag
- The HTML background attribute is used to set the background image for an HTML page.
- But HTML5 deprecate the background attribute so we can use CSS instead.
- The background-image CSS property is used to set the background image in the HTML.
Syntax for set background image in HTML
Syntax for set background image in HTML Using CSS
Difference between HTML4.01 and HTML 5:
HTML 4.01:
- HTML4 supports background attribute.
HTML 5:
- HTML5 does not supports background attribute.
Sample coding for set background image in HTML:
Code Explanation for set background image in HTML
- The background Attribute is used to set the background image for the HTML document.
Sample coding for set background image in HTML Using CSS
Code Explanation for set background image in HTML Using CSS
- The style Attribute is used to set the background-image for the HTML document Using CSS the url property is used to specify the URL of the image file.
Output for set background image in HTML
- The output shows that the HTML page with a background image
Browser Support for background image in HTML
Yes | Yes | Yes | Yes | Yes |