Basic concepts of CSS styles and attribute style labels
Classification of Style sheets
1. Inline style sheet
Combined with HTML display, the control is accurate, but reusability is poor, redundancy is many.
Example: <p style= "FONT-SIZE:14PX;" > Inline style Sheets </p>
2. Inline style sheet
embedded in a Web page as a separate area must be written inside the head tag.
<type= "Text/css">P //format works on p label { Style:}</style>
3. External style sheet
Create a new CSS file to place the style sheet. If you want to call a style sheet in an HTML file, you need to right-click in the HTML file →css style → attach a style sheet. The link connection method is generally used.
<rel= "stylesheet" href= "New CSS style sheet address" type= "text /css "/>
Some labels have default margins, which are usually removed (and other styles can be set) when writing style sheet code, as follows:
<styletype= "Text/css">*//format works on all labels{margin:0px;padding:0px; } </style>Selector Selector
1. Tag Selector. Use the tag name to make the selector.
< s Tyle Type = "Text/css" > p //format works on p tag { style; } </ style >
2.class Selector. It's All "·" Beginning.
<Head><styletype= "Text/css">#main/*Defining Styles*/{height:42px; Width:100%;text-align:Center;}</style></Head><Body><DivID= "Main"> <!-- Call ID style--></Div></Body>
4. Composite selector.
1). Separate with "," to indicate juxtaposition.
<type= "Text/css">p,span /* label P · span both the same style */ { style; }</style>
3.ID Selector. Start with "#"
<div id= "style name" >
CSS style Sheets