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


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Pseudo-Class Selector
 
Subject: Pseudo-Class Selector
Author: CyberSpider
In response to: Attribute Selector
Posted on: 04/12/2016 07:12:19 PM

Pseudo-class selector is used to find element with a specific state being set:

  • E:link -- any E element with link;
  • E:hover -- any E element with link being designated;
  • E:active -- any E element with link being pressed;
  • E:visited -- any E element with link being visited;
  • E:focus -- any E element being focused;
  • E:empty -- any E element that has no child element;
  • E:first-child -- any E element that is the first child element of its parent;
  • E:last-child -- any E element that is the last child element of its parent;
  • E:nth-child
  • E:nth-last-child
  • E:first-of-type
  • E:last-of-type
  • E:nth-type
  • E:target
  • E:checked
  • E:enabled
  • E:disabled

        a:hover {
            color: red;
            text-decoration: line-through;
        }
    


    Try it yourself in sandbox »

     

    > On 04/12/2016 06:34:01 PM CyberSpider wrote:

    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 »




    References:

  •  


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