- The * selector can also select all elements inside another element (See "More Examples").
- ID
- The id selector uses the id attribute of an HTML element to select a specific element.
- An id should be unique within a page, so the id selector is used if you want to select a single, unique element.
- To select an element with a specific id, write a hash character, followed by the id of the element.
- The class selector selects elements with a specific class attribute.
- To select elements with a specific class, write a period character, followed by the name of the class
- Pseudo-classes
- a:link (unvisited link)
- a:visited (visited link)
- a:hover (mouse over link)
- a:active (selected link)
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective! a:active MUST come after a:hover in the CSS definition in order to be effective! Pseudo-class names are not case-sensitive.
The :first-child pseudo-class matches a specified element that is the first child of another element.
0 nhận xét