what is default line-height of browsers like font-size is 16px?
for which HTML elements i should define line-height and for which not?
What is the reason behind to give line-height to body { } ?
Will line-height effect to single line text?
If I’m using font in em then should i also use use line-height in em?
What is co-relation between line-height and font-size?
In my experience, a common default line-height seems to be close to 1.2 (that would be ~19px leading for a 16px font (16*1.2)). In some browsers versions it’s about 1.1 – but I can’t remember ever seeing it outside that scope.
The line-height property is inherited from parent to child – so specifying a line-height on
<body>will affect all elements on the page, except the ones that have their own line-height property set, and their descendants. (See example below)Line height affects the height occupied by each character – so yes it also has an effect on single-line-of-text elements.
Line-height comes in three basic flavours:
1.2)14px)1.2em)Relative (unitless) values will apply proportionally equivalent line-height to all elements depending on their font-size.
Meanwhile, fixed values (
px) don’t change with the font-size.For explanation of the ‘fixed-relative’ variant (the ’em’-values) refer to Eric Meyer’s blog post “Unitless Line-Heights“.
Each flavour has it’s place in the world. 🙂
Here’s a short example of all three:
Each word in the example above would have the following line-heights (translated into
px)font-sizeofbody)font-sizeofsmall)pxvalue)pxvalue fromdiv)font-sizeofp(inherited frombody))p)