Why does Bootstrap set the line-height property to 1.428571429?

Twitter BootstrapCss

Twitter Bootstrap Problem Overview


line-height: 1.428571429;

Why does Bootstrap set line-height to this value?

(Some themes round it to 1.42857143.)

Twitter Bootstrap Solutions


Solution 1 - Twitter Bootstrap

The line-height is determined by dividing the targeted line-height size by the font-size. In this example, Bootstrap is baselining their line-height off of a 14px font-size. The target line-height is 20px:

20px ÷ 14px = 1.428571429

When determining your line-height, you want to make sure you have ample white space between your rows. This allows for ascenders and descenders without intruding on other rows. Also having ample white space allows your eyes to develop a visual rhythm while reading.

Also keeping the line-height unitless makes it more versatile. For more information, see Eric Meyer's post on this from February 2006.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZiyu ZhouView Question on Stackoverflow
Solution 1 - Twitter BootstrapHynesView Answer on Stackoverflow