CSS selectors commonly used selectors are as follows: 1, Tag Selector tag Selector, this kind of selector has a large scope of influence, it is recommended to apply in the hierarchy selector as far as possible. Example: *{margin:0;padding:0}div{color:red} <div>....</div> <!--corresponds to the above two styles--><div class= "box" > ....</div> <!--corresponds to the above two style-->2, the ID selector selects the element by the ID name, the element's ID name cannot be duplicated, so a style setting item can only correspond to the previous element of the page, cannot be reused, and the ID name is generally used by the program. It is therefore not recommended to use the ID as a selector. Example: #box {color:red} <div id= "box" >....</div> <!--corresponds to one of the above styles, other elements are not allowed to apply this style-->3, the class selector selects the element through the class name, A class can be applied to multiple elements, one element can use more than one class, the application is flexible, reusable, is the most applied in the CSS of a selector. Example:. red{color:red}.big{font-size:20px}.mt10{margin-top:10px} <div class= "Red" >....</div>
Brother Lian Learning python----several common selectors in CSS