Chapter 2 HTML subject tags, attributes, and color settings
To make your webpage colorful and attract more viewers to read, you can add more labels and attributes to the webpage to modify and layout the elements in the webpage. Next we will introduce these labels one by one.
1. html subject tag <body>
In <body> and </body>, all content, tabs, text, tables, forms, hyperlinks, and other settings are placed on the page.
The <body> tag has its own attributes. You can set the attributes in the <body> tag to control the display mode of the entire page.
<Body> tag attributes
Genus |
Description |
Link |
Set the default page connection color |
Alink |
Set the connection color when the mouse is clicked |
Vlink |
Set the color of the connected text after access |
Background |
Set page background image |
Bgcolor |
Set page background color |
Leftmargin |
Set the left margin of the page |
Topmargin |
Set the top margin of the page |
Bgproperties |
Set the page background image to be fixed and do not scroll with the page |
Text |
Set the color of the page text |
Format:
<Body text = "#000000" link = "#000000" alink = "#000000" vlink = "#000000" background = "gifnam.gif" bgcolor = "#000000" leftmargin = 3 topmargin = 2 bgproperties = "fixed">
Example: 2-1.html
<HTML>
<Head>
<Title> bady attribute instance </title>
</Head>
<Body bgcolor = "# ffffe7" text = "# ff0000" link = "# 3300ff" alink = "# ff00ff" vlink = "# 9900ff">
<Center>
<H2> set different connection colors </H2>
Test the body tag <p>
<A href = "http://www.baidu.com/"> default connection color </a>
<P>
<A href = "http://www.sina.com.cn"> connection color being pressed, </a>
<P>
<A href = "http://www.sohu.com/"> connection color after access, </a>
<P>
<A href = "#" onclick = "javascript: window. History. Back ()"> return </a>
</Conter>
</Body>
</Html>
Instance description:
The <body> attribute sets the background color and text color of the page. The link color is # 3300ff, the link color is # ff00ff, and the color after clicking is # 9900ff.
The link label in the body is the link label in the page. For the attribute, you can set it based on the page effect. We will also introduce the above attributes in the subsequent sections, and will not reference them one by one here. Our learning goal is to master the usage of tags and attributes.
Ii. color settings
A color value is a keyword or an RGB number. It is used in many web pages. Here we will introduce it first.
The color is composed of three primary colors: "red" "green" "blue". The color definition in HTML is hexadecimal, given two hexadecimal values for the three primary colors HTML, each of which can have 256 colors, the three primary colors can be mixed into 16777216 colors.
For example, the components of white are red = ff, Green = ff, Blue = ff, and RGB values are ffffff.
Red is composed of Red = ff, Green = 00, Blue = 00, RGB value is ff0000
The composition of green is Red = 00, Green = ff, Blue = 00, And the RGB value is 00ff00.
The blue is composed of Red = 00, Green = 00, Blue = ff, and the RGB value is 0000ff.
Black is composed of Red = 00, Green = 00, Blue = 00, RGB value is 000000
Applications often add the "#" symbol before each RGB value, for example, bgcolor = "#336699". When you use an English name to represent the color, write the name directly. For example, bgcolor = green
RGB colors can be expressed in four forms ::
- # Rrggbb(For example,#00cc00)
- # RGB(For example,#0c0)
- RGB (x, x, x) XIs an integer between 0 and 255 (For example,RGB (0,204, 0))
- RGB (Y %, Y %, Y %) YIs an integer between 0.0 and 100.0 (For example, RGB (0%, 80%, 0%)
Windows VGA (Video Image array) forms 16 keywords: Aqua, black, blue, Fuchsia, gray, green, lime, maroon, navy, Olive, purple, Red, silver, teal, white, and yellow
The following is a color RGB code chart: