Css front-end learning

                                

                 Introduction to CSS    

SS ( C ascading Style  Sheet  , Cascading Style Sheet) defines how to display HTML elements.

When the browser reads a style sheet, it formats (renders) the document according to the style sheet.

                CSS syntax:        

Every CSS style consists of two components: selectors and declarations. Declarations in turn include properties and property values. End each statement with a semicolon.

                    

                                 CSS comments           

 

/* The middle is the comment section */

 

                How to import CSS                                                       

 

 

<link href="mystyle.css" rel="stylesheet" type="text/css"/>

 

  

                CSS selectors       

Element selector:                    
p {color: "red";} 
#p label color is red
ID selector:
#id
{ background-color: red; }
The background color of the #id tag is red

Class selector:

.c1 {
  font-size: 14px;
}
p.c1 {
color: red;
}
#1 The font size of the label with the .c1 style class is 14px 
#2. The color of the label with the .c1 style class in the p tag is set to red

Notice:

Do not start the style class name with a number (some browsers do not recognize it).

If there are multiple class attributes in the tag, they should be separated by spaces .

 

Universal selector:

* {
  color: white;
} 
#Set the color of all css tags to white
 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324880511&siteId=291194637