How background attribute is deprecated in HTML5 ?
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.
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.
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.