2016-11-07
"CSS Primer Classic", chapter eighth
1. Property Selector
| Selector | Selector
Description |
| [attribute] |
Used to select an element with the specified attribute. |
| [attribute=value] |
Used to select an element with the specified attributes and values. |
| [attribute~=value] |
Used to select the element in the attribute value that contains the specified vocabulary. |
| [attribute|=value] |
Used to select an element with an attribute value that begins with the specified value, which must be the entire word. |
| [attribute^=value] |
Matches each element of the property value to the beginning of the specified value. |
| [attribute$=value] |
Matches each element of the property value to the end of the specified value. |
| [attribute*=value] |
Matches each element of the property value that contains the specified value. |
Note: IE (until version 5.5) does not support the property selector.
2. Close relatives Selector
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Notes</title>6 <style>7 Li+li{8 Color:Red;9 }Ten </style> One </Head> A <Body> - <ul> < binID= "html">Html</Li> the <LiID= "Java">Java</Li> - <binID= "CSS">Css</Li> - </ul> - </Body> + </HTML>
Sibling element: Has the same parent.
Next-of-kin elements: if the second of the source code appears directly after the first, then they are close relatives.
As above, <li> with ID HTML and Java is a close relative element, and Java and CSS <li> is a close relative element, but HTML and CSS <li> is not a close relative element.
Note: the next-of-kin selector makes a choice for situations based on two close relatives, but it applies the declared style to the second of the two.
As a result, the above program only has Java and CSS fonts turned red, and HTML is the default color.
3. About <dl> tags, the kinship selector is used to add or remove borders, fills, and borders.
The <dl> tag defines a definition list.
<dl> tags are used to combine <dt> (define items in a list) and <dd> (describe items in a list).
1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4 <MetaCharSet= "UTF-8">5 <title>Notes</title>6 <style>7 Body{Color:#969;}8 H1{font-size:15px;}9 Dd+dt{Ten Margin-top:10px; One } A DD+DD{ - Font-style:Italic; - font-size:10px; the } - </style> - </Head> - <Body> + <H1>Front-end development</H1> - <DL> + <DT>Html</DT> A <DD>Hypertext Markup Language</DD> at <DD>See also:xhtml</DD> - - <DT>Css</DT> - <DD>Cascading Style Sheets</DD> - <DD>Css</DD> - in <DT>Www</DT> - <DD>World Wide Web</DD> to </DL> + </Body> - </HTML>
CSS Advanced Selector