How To Set The Background Color

Table of contents:

How To Set The Background Color
How To Set The Background Color

Video: How To Set The Background Color

Video: How To Set The Background Color
Video: How To Change Background Color in Photoshop (Fast u0026 Easy!) 2024, May
Anonim

Typically, the base background color of a web page is set using the Cascading Style Sheets (CSS). Less commonly, the capabilities of the HTML language (HyperText Markup Language - "hypertext markup language") are used for this. Sometimes CSS description elements are placed inside HTML tags.

How to set the background color
How to set the background color

Instructions

Step 1

Use the bgcolor attribute of the body tag if you want to make it as easy as possible to specify the background color and to minimize changes to your source code. Descriptions of all page elements are placed in the page source inside a block of HTML code that starts with a tag and ends with a tag. The bgcolor attribute is specified in the opening tag and contains the named color value (for example, Red or Chocolate) or its corresponding hexadecimal color code (# FF0000 or # D2691E, respectively). In its simplest form, such a tag can be written, for example, like this: Or like this: Both options set the same red color for the background of the document.

Step 2

Use the background-color property if you want to set the background color of a document using a style description language - this method is much more common. Style description blocks can either be included in the source code of the document, or written in a separate file with the css extension. A link to an external file is placed in the heading part of the page (between the and tags) and looks something like this: @import "style.css"; If there is no need to move the CSS instructions into an additional file, then @import "style.css"; should be replaced, for example, with the following test: body {background-color: Red;} Here body indicates that the statement inside the curly braces that defines the red background color refers to the same HTML body tag. And here there are several systems for determining color shades, but hexadecimal codes are most often used: body {background-color: # FF0000;}

Step 3

Replace the background-color property with background to concisely describe a more complex background structure. For example, if, in addition to the background of a certain color, a picture must be placed in the document background. Such a description might look like this: body {background: Red url (img / BGimage.gif) no-repeat;}

Step 4

Based on the option you have chosen, prepare a code that sets the background color of the document, and paste it into the source of the page. This can be done, for example, using the online editor of the pages of the content management system or in any text editor.

Recommended: