What is bgcolor in HTML

SELFHTML/ Quickbar HTML  File-wide colors and background


Color for the background

Display example: This is what it looks like

You can specify a color for the background of the display window. The entire HTML file is displayed on this background color.

Example:

<body bgcolor=#CCFFFF>

Explanation:

The background color is specified in the opening tag of the HTML file (see  Basic structure of an HTML file. With the attribute you determine the color for the screen background (bgcolor = background color = background color). The entire HTML file is displayed on the background color defined here. The rules for the color selection apply  Defining colors in HTML.

Note:

If you create a document from several HTML files that should have a uniform background and text foreground, you must redefine the background color in each HTML file. Of course, you can also define different colors for each HTML file.

If you define a background color, you should also define suitable (contrasting) text foreground colors (see the following section).

 

Color for text and references

Display example: This is what it looks like

You can define file-wide colors:
  • for text (valid for all elements such as headings, normal body text, lists, etc.)
  • for references to positions not yet visited
  • for references to places already visited
  • for referrals as they are clicked

Example:

<body bgcolor=#663333 text=#FFCC99 link=#FF9966 vlink=#FF9966 alink=#FFFFFF>

Explanation:

The information is given in the opening tag of the HTML file (see  Basic structure of an HTML file. The rules for the color selection apply  Defining colors in HTML.

With you define a color for the text.
With you define a color for references to files not yet visited (link = reference).
With you define a color for references to files that have already been visited (vlink = visited link = visited link).
With you define a color for links that the user is currently clicking (alink = activated link = activated link).

Note:

The defined text foreground colors should contrast with the defined background color. For example, if you define a dark background color, you should choose light text foreground colors (e.g. white, yellow, light green and light blue).

 

More options

If you already know HTML a little better, try out the options that are available to you  CSS style sheets Offer. Because you can also use it to define colors for a file. To do this, you first need to know how to  Define style sheets can. You will then be able to apply style sheet information. By applying style sheet information to the tag, you have a lot more options available than with the attributes described here. You can also  Define style sheets in a separate file and then embed this file in any number of HTML files in your project. This makes it easier to work with a cross-file layout. For example, the following style sheet information is of interest in the context described here:
 Background colors and images
 Pseudo-formats for references
 Frame and padding

The tag can  Universal attributes contain.


 

SELFHTML/ Quickbar HTML  File-wide colors and background

© 1998 Stefan Münz, [email protected]