Use a space or greater than sign > in CSS selector - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element parent child

Description

Use a space or greater than sign > in CSS selector

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials