Front-end learning-Css--Attribute Selector

Source: Internet
Author: User

Property selector: Select the specified element based on the attribute of the element

Syntax: [Property name] Select the element with the specified attribute

    1. [Property Name = property value]: Select an element with a property value equal to a specified value
    2. [Property name ^= property value]: Select an attribute value to specify the element at the beginning of the content
    3. [Property name $= property value]: Select an attribute value to specify the element at the end of the content
    4. [Property name *= property value]: Select the element in the attribute value that contains the specified content

Demo: (Note: This awkward verse must not have been written by me)

<!DOCTYPE HTML><HTML>    <Head>        <MetaCharSet= "Utf-8">        <title></title>        <styletype= "Text/css">            /*[Property Name = property value]: Select an element with a property value equal to a specified value*/h2[title= "ABCDE"]{Color:Red;            }            /*[Property name ^= property value]: Select an attribute value to specify the element at the beginning of the content*/h3[title^= "O"]{Color:Green;            }            /*[Property name $= property value]: Select an attribute value to specify the element at the end of the content*/h4[title$= "C"]{Color:Blue;            }            /*[Property name *= property value]: Select the element in the attribute value that contains the specified content*/h1[title*= "DF"]{Color:Blue;            }        </style>    </Head>    <Body>        <!--[email protected] Time: 2017-03-18 Description: Title is when the mouse moves up, suspended in the above content -       <H1title= "DFC">To the daughter's book</H1>       <H2title= "ABCDE">Pot Twombly Writing poetry is important</H2>        <H3title= "OPQ">Their craft is more important than men.</H3>       <h4title= "CDE">Chest and waist and buttocks are more important than face</h4>       <h5>Strong inside, son of a.</h5>       <h6>is more important than anything.</h6>       <BR/>       <BR/>        <H1title= "CDE">To the daughter's book</H1>       <H2title= "OPQ">Pot Twombly Writing poetry is important</H2>        <H2title= "ABCDE">Their craft is more important than men.</H2>       <h4title= "ABC">Chest and waist and buttocks are more important than face</h4>       <h5>Strong inside, son of a.</h5>       <h6>is more important than anything.</h6>       <BR/>       <BR/>       <H1title= "CDE">To the daughter's book</H1>       <H1title= "DFDF">To the daughter's book</H1>    </Body></HTML>

Front-end learning-Css--Attribute 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.