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


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Element Type Selector
 
Subject: Element Type Selector
Author: CyberSpider
In response to: Universal Selector
Posted on: 04/11/2016 06:46:54 PM

The element type selector is used to find elements with the corresponding element type name.

    p {
        text-align: center;
        color: green;
    }


Try it yourself in sandbox »

The above style is going to apply unto all <p> elements within the HTML document.

To narrow down the scope to find the element, the path can be used:
  • A E -- any E element that is descendant of element A;
  • P > E -- any E element that is child of element P;
  • S + E -- any E element that is immediately preceded by a sibling element S.

        table td {
            color: green;
        }
        tr > td {
            text-decoration: line-through;
        }
        table + p {
            background-color: red;
        }
    


    Try it yourself in sandbox »


     

    > On 04/10/2016 10:08:26 PM CyberSpider wrote:

    The universal selector (*) is to target everyone or all HTML elements.

      * {
            color: red;
            text-align: center;
      }
    


    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.