HTML CSS examples for CSS Widget:UL Element
apply last-child only for first nested li
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> ul.main>li>ul>li:first-child>a { background:green; } </style> <!-- ww w . ja v a 2 s. c om--> </head> <body> <ul class="main"> <li>Lorem ipsum d <ul> <li> <a>Lorem ipsum</a> <ul> <li> <a>Lorem ipsum d</a> </li> </ul> </li> </ul> </li> </ul> </body> </html>