HTML CSS examples for CSS Selector:element parent child
Child selector to target only the parent items and child items
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> ul.parentList li { color:Chartreuse; } ul.childList li { color:yellow; } </style> <!--from w w w. ja v a2s . c om--> </head> <body> <div id="container"> <ul class="parentList"> <li>Lorem ipsum dolor <ul class="childList"> <li>Lorem ipsum dolor</li> </ul> </li> <li>Lorem ipsum dolor </li> <li>Lorem ipsum dolor </li> <li>Lorem ipsum dolor </li> </ul> </div> </body> </html>