Class is a class used to define the style attribute.
It is more convenient to use class when using CSS (style sheet.
Example:
File 1: c1.css
. Bar
{
Border-Right: 2px outset;
Border-top: 2px outset;
Overflow: auto;
Border-left: 2px outset;
Border-bottom: 2px outset;
}
. Bcap
{
Color: graytext;
}
. Bdroper
{
Border-Right: 2px outset;
Border-top: 2px outset;
Border-left: 2px outset;
Width: 1px;
Cursor: move;
Border-bottom: 2px outset;
Position: static;
Height: 100%;
}
This file defines three classes ):
Bar toolbar Style
Style of the bcap toolbar title
Bdroper toolbar drag button style
File 2: Main. htm (HTML)
<HTML>
<Head>
<Link href = "c1.css" type = text/CSS rel = stylesheet> <! -- Path of the style sheet -->
</Head>
<Body>
<Div class = "bar">
<A class = "bdroper"> </a>
<A class = "bdroper"> </a>
<A class = "bcap"> browse </a>
<A href = "javascript: history. Back (1)"> return </a>
<A href = "javascript: history. Forward (1)"> forward </a>
</Div>
<Body>
</Html>
If the style sheet is not used, the content of file 2 is as follows:
It can be seen that if you use style sheets and class attributes, the style definition can be much simpler.
<A href = "index. jsp" class = "atop">
This defines a hyperlink and Its Class is atop. If you can find the style sheet of this webpage, you will find the definition of this class. It may be like this:
. Atop
{
.....
}
Of course, you can also use multiple style sheets on a webpage:
...
<Head>
<Link href = "c1.css" type = text/CSS rel = stylesheet> <! -- Path of style table 1 -->
<Link href = "../c2.css" type = text/CSS rel = stylesheet> <! -- Path of style table 2 -->
<Link href = "DD1/S1/Main. CSS" type = text/CSS rel = stylesheet> <! -- Path of style table 3 -->
</Head>
...