Example of Selector grouping and Contextual Selector on CSS

后端 未结 2 819
有刺的猬
有刺的猬 2020-12-21 18:52

I\'m going to have an exam tomorrow and I\'m trying to understand the meaning and the answer of

Selector grouping and Contextual Selector

While I searched

相关标签:
2条回答
  • 2020-12-21 19:04

    Basically what you looking at is the following.

    for

    a. Selector grouping example 
    
       td, th, li { property: value; }
    

    what the above is saying that you want to have the same value for the same property for all td,th, and li

    b. Contextual Selector example 
    
       table p { property: value; } 
    

    this one is saying that you want to set the value for <p> tags that belongs to <table> tags

    so whenever you have a <p> in a <table>, then it will get effected.

    0 讨论(0)
  • 2020-12-21 19:17

    Selector grouping: Groups the kinds of elements to which style is applied.

    Contextual Selector: Check the context of the class in the html tree, assigning the style to the element through a specific route, taking into account the order of depth in the tree.

    0 讨论(0)
提交回复
热议问题