Selectors in CSS

Photo by Andrew Neel on Unsplash

Selectors in CSS

Β·

1 min read


TYPES OF SELECTOR IN CSS:

  • there are various type of selector in html

  • the commonly used selector are class and id

    MORE SELECTORS:

  • SELECTOR LIST

       .class1 , .class2 , .class3{
    
      }
    
    • this is a example of selector list

      Descendent Selector:

    •   main p {
      
        }
      

      example of descendent selector

Child Selector:

main > p{

}

example of child selector

Adjacent sibiling Selector:

section + p{
    any p tag just after section it will look for it
}

General Sibiling Selector:

section ~ p{
    look in the full css document for all the p tag present in the file
}

Attribute Selector:

[target="_blank"]{
    select the attribute 
}

Attribute value Selector :

[alt~="sk"]{
    select the attribute with the sk value only
}

Thanks for reading and have a great day!

Β