Line-Height matching the font-size - HTML CSS CSS Property

HTML CSS examples for CSS Property:font-size

Description

Line-Height matching the font-size

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit ame</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
p {<!--   w  ww. j ava  2s. c  o  m-->
   color:Chartreuse;
   background:yellow;
}

.short {
   line-height:2em;
}

.tall {
   line-height:3em;
}

.small {
   font-size:9px;
}

.normal {
   font-size:17px;
}

.large {
   font-size:33px;
}
</style> 
 </head> 
 <body> 
  <div class="small"> 
   <p>Lorem ips</p> 
   <br> 
   <p class="short">Lorem ip</p> 
   <br> 
   <p class="tall">Lorem i</p> 
   <br> 
  </div> 
  <div class="normal"> 
   <p>Lorem ips</p> 
   <br> 
   <p class="short">Lorem ip</p> 
   <br> 
   <p class="tall">Lorem i</p> 
   <br> 
  </div> 
  <div class="large"> 
   <p>Lorem ips</p> 
   <br> 
   <p class="short">Lorem ip</p> 
   <br> 
   <p class="tall">Lorem i</p> 
   <br> 
  </div>  
 </body>
</html>

Related Tutorials