CSS3 New Property Selector

Source: Internet
Author: User

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

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.