Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font size and line height for a Web page

Tags:

html

css

What is the best value for font size and line height where readability is concerned?

I myself prefer huge font size and greater line height like the one used in Dive into Python 3.

like image 208
riza Avatar asked Dec 09 '22 20:12

riza


2 Answers

As with every other "what's the best" question in the world, the answer to this is "there is no 'best'" :-)

For font-size, arguably the 'best' is whatever the user has chosen themselves, either as the default or the minimum. In other words, leave the font size alone for main body copy, and only increase it for headings. You might consider decreasing it by a very small amount for non-critical content. 16px is generally the browser default.

For line-height, values between 1.3 and 1.5 are typically recommended for good readability, although this varies with font face and line length.

like image 161
Bobby Jack Avatar answered Dec 27 '22 09:12

Bobby Jack


According to what W3C recommended, always use relative font size (em).

use

h1 { 
    font-size: 2em;
    line-height: 2.5em;
}

instead of

h1 { font-size: 24px; line-height: 30px; }

So that user can always override the default font size.

like image 34
xandy Avatar answered Dec 27 '22 08:12

xandy