Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

How background attribute is deprecated in HTML5 ?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

In this article, we will know the Deprecation of background Attribute, along with understanding its implementation through the examples. Attributes in HTML are used to provide additional features to the elements. The attributes are specified in the tags.

The background attribute is used to specify or set all background style properties at once, like – size, color, image, origin, repeat, position method. In other words, it is used to define the background effects that can be used with the elements.  

Syntax:

<body background="url">Content</body>

HTML5 deprecates various elements like font, center, background, and many others & these effects can be implemented using CSS & which is used to separate the presentation style of a web page from its content. CSS provides style information for a web document & helps to simplify the task of maintaining a website by separating the formatting information from the structure and content of the website.

Please refer to the What are the HTML tags that deprecated in HTML5? article for more details about the deprecated tags & attributes.

Example: This example describes the use of the background attribute with <body> tag, for adding the image URL in the background. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title> HTML Background Attribute </title>
</head>
 
<body background=
    <center>
        <h1>GeeksforGeeks</h1>
        <h2>HTML background Attribute</h2> <a href="#">
            It is a Computer Science portal For Geeks
        </a>
    </center>
</body>
 
</html>

Output:

HTML background attribute

Note: The background attribute is deprecated in HTML5. We can use the CSS background-image Property that facilitates setting the background images for an element.

My Personal Notes arrow_drop_up
Last Updated : 17 Jan, 2022
Like Article
Save Article
Similar Reads
Related Tutorials