How To Set The Background In Html

Table of contents:

How To Set The Background In Html
How To Set The Background In Html

Video: How To Set The Background In Html

Video: How To Set The Background In Html
Video: HTML u0026 CSS for Beginners Part 13: Background Images 2024, December
Anonim

The most common hypertext markup language today is HTML. In addition to a wide range of tools for determining the structure of a document, it has the ability to change their visual presentation. For example, you can set the background of a hypertext document and its elements in different ways.

How to set the background in html
How to set the background in html

It is necessary

the ability to edit an HTML document

Instructions

Step 1

To set the background color of the entire document, tables, as well as their rows, header cells and content cells in HTML, use the bgcolor attribute of the BODY, TABLE, TR, TH, TD elements, respectively. This attribute accepts a value that encodes the color of the SRGB space, expressed as a hexadecimal number preceded by a hash or symbolic mnemonic. For example:

Step 2

Use the background attribute of the BODY element to define the image that will be the background of the entire document: In accordance with the principle of separating the structure and mechanisms for determining the visual presentation of hypertext documents, it is recommended to use style sheets instead of the attributes of HTML elements (as described in steps 1 and 2) …

Step 3

Set the background color of any element using the background-color CSS property. Use the style attribute to define inline style information for an element, or add rulesets with appropriate selectors to style sheets: green background BODY {background-color: # 00FF00; }

Step 4

Define the background image of any element or group of elements using the CSS background-image property. Its value must be a URI identifying the associated resource. For example: BODY background-image {background-image: url ("myimage.gif")}

Step 5

Set additional rules for displaying the background image of document elements. Use the background-repeat, background-attachment and background-position CSS properties. The first defines the tiling options, the second defines the docking relative to the document or viewport, and the third defines the initial offset or alignment relative to the container's boundaries. Check out the CSS2 specification at w3c.org for possible values for these properties.

Recommended: