Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS css Reply To: css

#248001
Shikkediel
Participant

It means a direct child of. In your example p would have to be a first-line descendant of div and div in it’s turns can only have body as it’s immediate parent.

<body>
  <div>
    <p></p>
  </div>
</body>

So this won’t do:

<body>
  <header>
    <div>
      <p></p>
    </div>
  </header>
</body>

Because div is not a direct child of body but of header instead. Then it would have to be:

body div > p

Meaning any descendant of body that is a div. With a direct child that is a p element.

https://css-tricks.com/child-and-sibling-selectors/