What are CSS selectors? CSS Selector Precedence Determination

Source: Internet
Author: User
The selector is the tag that specifies the CSS to function, and the name of the tag is the selector. Select which container (the label itself is the container that encapsulates the data).

@CHARSET "UTF-8";           There are many kinds of selectors in/*css, the first is the most basic element selector (aka Type selector).           * The element of the document is the most basic selector.          * If you set the HTML style, the selector will usually be an HTML element, such as p, H1, EM, a, or even the HTML itself: */h2{Color:blue;     }/* Second selector: class style selector///* Set all "AA" class styles. aa{background-color: #00FF00;     }/* * Just set the "AA" style in P */p.aa{Background-color: #00FF00;      }. bb{Background-color: #004444;          }/* The third selector ID selector *id selector allows you to specify a style in a way that is independent of the document element.      * In some ways, the ID selector is similar to a class selector, but there are some important differences.     *//*id Selector */#d1 {background-color: #0000FF;      }/* Other selectors *//*1. Association selector */P span{/* Select the span*/font-size:20pt in the P label container;    }/*2. Combo selector */P span,.c, #d1 {color:red; /*3. Pseudo-Element selectors//*CSS pseudo-elements are used to set special effects to certain selectors.          */span:hover {background-color: #FFFF00;          font-size:20pt;   Cursor:pointer; } a{teXt-decoration:none;      }/*l-v-h-a*/a:link{color:red;   font-size:12pt;     } a:visited{Color:blue;   font-size:16pt;     } a:hover{Background-color: #00FF00;   font-size:20pt;   } a:active{color: #FFFF00;   } input:focus{Background-color: #00FFFF;   }/* Asterisk selector, select all */*{text-decoration:underline;   }/* Property selector, all elements with the type attribute */[type]{margin:10px;   }/* has the name attribute and the property value is ' math ' */[name= ' Math ']{background-color: #0ff;   } a[href= "http://www.w3school.com.cn/"][title= "W3school"] {color:red;   }/* Association selector---descendants */h1 em{color:red;   }/* child element Selector---son */p > em{color:blue;   }/* Adjacent element selector---successor Brother */Li + li {font-weight:bold; }

Related articles:

CSS class selector and ID selector

CSS Selector collation

Related videos:

Class Selector-2016 new curriculum system HTML+CSS video

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.