Use CSS (style sheet) Class

Source: Internet
Author: User
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>
...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.