Css selector hierarchy

From Logic Wiki
Revision as of 14:27, 9 May 2016 by Dt1nh6 (Talk | contribs) (1 revision imported)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The following example selects all < p > elements inside < div > elements:

div p {background-color: yellow;}

The following example selects all < p > elements that are immediate children of a < div > element:

div > p {background-color: yellow;}

The following example selects all < p > elements that are placed immediately after < div > elements:

div + p {background-color: yellow;}

The following example selects all < p > elements that are siblings of < div > elements: Same level with div but not div

div ~ p {background-color: yellow;}