HTML CSS examples for CSS Selector:element parent child
Use a space or greater than sign > in CSS selector
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .welcome div<!--from ww w. j a v a 2 s . c o m--> { font-size:21px; border:2px solid Chartreuse; } .content>div { font-size:21px; border:2px solid yellow; } </style> </head> <body> <div class="welcome"> <div> Lorem ipsum dolor s <div> Lorem ipsum dolor s </div> </div> </div> <div class="content"> <div> Lorem ipsum dolor s <div> Lorem ipsum dolor s </div> </div> </div> </body> </html>