First, the basic grammar
1,css Introduction Method
<link rel= "stylesheet" type= "Text/css" href= "Styles.css" >
2,CSS writing format
h1,h2{Color:blue;font_size}
Two, derive selectors:
Defines the context style based on the element's position relationship.
For example: We only want the strong in Li to change its style to red, while the strong of P does not change.
<p><strong>p strong</strong></p> <ul> <li><strong>li STRONG</STRONG&G T;</li> </ul>
Li strong{color:red;}
Three, ID base selector
The 1,id selector can be identified by an HTML page labeled with an ID. Use # to define.
<p id= "Id1" >id testttttt</p>
#id1 {color:pink;}
The 2,id selector and the derived selector work together
<p id= "Id1" >id testttttt<a href= "aasdfasf" >www.baidu.com</a></p>
#id a{Color:blue;}
four, class selector;
Displayed at a point. He can also be used as a derivative selector
<p class= "Pclass" > This is the class tag ah </p>//css. pclass{color:red;}
He can also make derivative selectors to use.
Five, Property selector:
Sets the style for the HTML element with the specified style.
<p title= "F" >shuxingxuanzeqiadafsadf</p>//css <style type= "Text/css" > [title]{color:red; } </style>
Properties and value selectors.
<p title= "F" >shuxingxuanzeqiadafsadf</p> <p title= "KK" >shuxingxuanzeqiadafsadf</p>//css <style type= "Text/css" > [title]{color:red; } [title= "KK"]{color:blue; } </style>
CSS3 Basic Syntax