<div class="body">
<div class="why-not-twenty-px">
containing div has height
<span class="smaller"> •</span>
of 21px, not 20px
</div>
<div class="abcd">
<span>The same problem can </span>
<span style="vertical-align:middle;color:grey;"> be replicated </span>
<span> while using tags with same font-size and line-height, height will be 21px</span>
</div>
<div class="why-not-sixty-px">
containing div has height of 61 px, not 60px multiline multiline multiline multiline multiline multiline <span class="smaller">•</span> multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline multiline
</div>
</div>
CSS
body
{
line-height: 20px;
font-size: 14px;
}
.smaller
{
font-size: 12px;/*I prefer to use px over em, same as 0.9em*/
vertical-align: middle;
line-height: 12px;/*use any smaller line height compared to siblings*/
}
.abcd span{
text-decoration: underline;
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.