There is no background tag in HTML. What might have been called a background tag in earlier versions of HTML: the background attribute of the HTML tag
– was used to display a background image for a web page. The current World Wide Web Consortium (W3C) recommendation is HTML 4.01 / XHTML 1.0. In this recommendation, the background attribute has been deprecated: it is no longer considered valid HTML. The related bgcolor attribute, which can be thought of as a background tag, is also deprecated.
Background tags provided detailed background information for web pages in earlier versions of HTML, but this function is achieved through style sheets in newer versions.
Cascading Style Sheets (CSS) should be used to set all background effects in a valid HTML or XHTML web page. Using CSS to set background properties is much more flexible than the previous method. The background attribute, or background tag, was limited to displaying a background image. Background properties in CSS can define where the background image starts, how it repeats and scrolls with the rest of the page, or stays in place. CSS background properties can be applied to an entire web page or to elements on the page.
Background properties include background color, background image, background fixation, background position, and background repeat. All of these properties can be consolidated into the background property instead of being defined as separate properties. This is called a shorthand property.
Like the old bgcolor attribute, the background color can be in the form of an RGB value, a hex code, or a color name. The background of any element to which this property is applied will be displayed in this color. The value of background-image is the URL of the image.
The other properties (background attachment, background position, and background repeat) can be configured, but if not, the default values will be used. Background Repeat is used to repeat the background vertically or horizontally; by default, it repeats vertically and horizontally. The background attachment causes the background image to scroll with the rest of the page, which is the default, or stay in one place. The default background position is the top left corner of the element.
Different web browsers may display background properties differently or require more specific CSS settings. For example, while Internet Explorer® 8 supports inherited values for some properties, it does not support background properties. In Firefox®, the background-position property does not work correctly if the background-attachment property is not set. Developers should test their pages in a variety of browsers to make sure the pages display as intended.