CSS Child vs Descendant selectors

前端 未结 8 2012
心在旅途
心在旅途 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:59
    div p 

    Selects all 'p' elements where the parent is a 'div' element

    div > p

    It means immediate children Selects all 'p' elements where the parent is a 'div' element

    0 讨论(0)
  • 2020-11-22 04:00

    Be aware that the child selector is not supported in Internet Explorer 6. (If you use the selector in a jQuery/Prototype/YUI etc selector rather than in a style sheet it still works though)

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