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