Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

children selector in css

I have a nested html like this:

<div id="feautred">
  <div></div>
  <p></p>
  <ul></ul>
  <dl></dl>
</div>

For normal markup I could use #featured > div but here is not only the div is nested. There may be anything. So, how can I use #featured > ???? selector here?


Doing #featured > * will select all inner children what I don't need! I want only main children elements to be selected.

Upvotes: 1

Views: 48

Answers (2)

witherwind
witherwind

Reputation: 472

Maybe something like this?

#featured + p { }

This will select all paragraphs that are following #featured.

Upvotes: 0

MarcinJuraszek
MarcinJuraszek

Reputation: 125620

You can use *:

#features > *

from specification:

The universal selector, written as a CSS qualified name [CSS3NAMESPACE] with an asterisk (* U+002A) as the local name, represents the qualified name of any element type.

Upvotes: 5

Related Questions