CSS Child vs Descendant selectors

前端 未结 8 2204
心在旅途
心在旅途 2020-11-22 03:36

I am a bit confused between these 2 selectors.

Does the descendent selector:

div p

select all p withi

8条回答
  •  佛祖请我去吃肉
    2020-11-22 03:45

    CSS selection and applying style to a particular element can be done through traversing through the dom element [Example

    Example

    .a .b .c .d{
        background: #bdbdbd;
    }
    div>div>div>div:last-child{
        background: red;
    }
    
    The first paragraph.
    The second paragraph.
    The third paragraph.
    The fourth paragraph.
    The fourth paragraph.

提交回复
热议问题