###1. How best to set line-height
Q. You want text on your website to be double-spaced by default. Which of the following line-height
values is the best way to achieve this?
200%
2em
2
double
A. First off, double
is a red herring. The only keyword value that line-height
accepts is normal
. 2em
will certainly give you double-spaced text for the element it's applied to; but so will 200%
.
The correct answer is 2
. Always specify line-height
as a unitless number; that way, descendent elements that specify a different font-size will inherit that number rather than a fixed line height.
Setting line-height to 2
tells the browser to preserve the font-size/line-height ratio even when the font size changes. The line height for the body will be 24pt, but for the heading's 24pt font, the line height will automaticlly increase to 48pt.