With CSS selectors, you can implement a STYLE element that corresponds to multiple HTML documents, and the preceding section of {} is the selector, which indicates the object of the style.
Added three property selectors to CSS: [Att*=val], [Att^=val], and [Att$=val]
The id= "Top" ATT is an ID, similar to a property such as class,href~~.
[Att*=val] Property Selector
If the attribute value of an element Att property contains a Val-specified character, then the element uses this style.
[Att^=val] Property Selector
If the value of the attribute of the Att property is preceded by the character identifier with Val specified, then the element uses this style.
[Att$=val] Property Selector
If the end character of the attribute value of the Att property of an element is identifier with the character specified in Val, then the element uses this style.
1 <!DOCTYPE HTML>2 <HTML>3 <HeadLang= "en">4 <MetaCharSet= "UTF-8">5 <title></title>6 <style>7 [Id*=po]{Background-color:Pink;}8 [Id^=bo]{Background-color:Cadetblue;}9 [Id$=\-1]{Background-color:LightBlue}Ten A[href$=jpg]:after{ One content:"This is a picture!"; A Background-color:lightcoral; - } - </style> the </Head> - <Body> - <DivID= "Poop">Poop [Id*=po]</Div><!--as long as it has a PO, it takes effect . - - <DivID= "Ppop">Ppop [Id*=po]</Div> + - <DivID= "Bo">Bo [Id^=bo]</Div><!--It starts with Bo, it takes effect . - + <DivID= "Bbo">Bbbo [Id^=bo]</Div> A at <DivID= "Co-1">[Id$=\-1] Co-1</Div><!--The end is-1 effective, \ is escaped - - <DivID= "Co-2">[Id$=\-1] Co-2</Div> - - <ahref= "1.jpg">A[href$=jpg]:</a> - </Body> - </HTML>
The effect is as follows:
CSS3 New Property Selector