go to  ForumEasy.com   
CSS + jQuery
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Attribute Selector
 
Subject: Attribute Selector
Author: CyberSpider
In response to: ID Selector
Posted on: 04/12/2016 06:34:01 PM

Attribute selector embraced by square brackets '[]' is used to find elements which have certain attributes matched in the source document:

  • E[attr] -- any E element that has attribute 'attr' regardless of its value;
  • E[attr=val] -- any E element that has attribute 'attr' with value of 'val';
  • E[attr~=val] -- any E element that has attribute 'attr' containing value of 'val';
  • E[attr|=val] -- any E element that has attribute 'attr' with value of 'val' or starting with 'val-';

        p[class="green"] {
            color: green;
            text-decoration: line-through;
        }
    


    Try it yourself in sandbox »

     

    > On 04/12/2016 05:59:55 AM CyberSpider wrote:

    While Class selector targets all elements of the same class, ID selector preceded by '#' focuses on finding a specific element with the unique identifier.

        #first {
            color: red;
            text-decoration: line-through;
        }
    


    Try it yourself in sandbox »





    References:

  •  


     
    Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.