CSS style Sheets

Source: Internet
Author: User

Style sheets are divided into three main categories: inline, inline, and external style sheets.

Inline style sheets are displayed in conjunction with HTML, written in the body tag, and are controlled precisely, but with poor usability. The effect is prioritized in three styles.

Inline is written as a separate area inside the head tag. The body tag has the corresponding tag: <div id/name/class= "" ></div>.

The external style sheet is a new CSS file that is used to place the style sheet and link to it in HTML.

<link type= "Text/css" rel= "stylesheet" href= ". /.. /css/new_file.css "/>
<HTML>    <Head>        <MetaCharSet= "UTF-8">        <title></title>        <style>            /*page Content Margins*/            *{margin:10px;padding:10px;        }/*id Selector */#div1{width:100px;Height:100px;Background-color:Red;                    }        /*class Selector*/. Div-class{width:200px;Height:200px;Background-color:Black;                    }        /*Tag Selector*/Div{Border:5px;solid salmon; }                        /*Property Selector name can be customized*/[Name=n]{width:300px;Height:300px;Background-color:Blueviolet;        }                /*Composite Selector*/        /*Parallel Selector*/. C,.C2{width:200px;Height:200px;Background-color:Brown;        }        /*descendant Selector*/. CC span{Color:Red;        }                /*other*/. X1{width:500px;                    }. X2{Height:500px;Background-color:Cadetblue;                    }                </style>        <Linktype= "Text/css"rel= "stylesheet"href=".. /.. /css/new_file.css "/>    </Head>    <Body>        <!--First Direct reference (priority) -        <Divstyle= "width:100px; height:100px; background-color:darkblue;">Ssddd</Div>        <!--The second Kind -        <DivID= "Div1"></Div>        <!--Third Kind -            <DivID= "Div2"></Div>        <Divclass= "Div-class"></Div>                    <!--ID cannot be duplicated class can repeat name can repeat -                <DivSB=n></Div>        <Divclass= "C"></Div>        <Divclass= "C2"></Div>        <Divclass= "CC">            <span>Ffddsssssssd</span>        </Div>        <span>Ffddsssssssd</span>                        <Divclass= "x1 X2"></Div>    </Body></HTML>

In the style sheet, the size is expressed in px. In the course of Web page editing, the embedded style sheet can be written together with the corresponding label, then the unified typesetting is written in the head, or moved to the external style sheet CSS file. The style sheet is not styled with a style label in the CSS file.



CSS style Sheets

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.