Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Body font-size px vs %
Message
De
23/12/2014 04:09:57
 
 
Information générale
Forum:
CSS
Catégorie:
Style
Divers
Thread ID:
01612553
Message ID:
01612607
Vues:
64
>Since I added Bootstrap to my project which has font-size set to 62.5% in the HTML style, I have to review my .CSS file. First, according to what I read online, 62.5% is the "industry standard" but I don't understand why. So I accept it as such.
>
>Prior to this "62.5%" I had/have my CSS define the body font size as 100% (as follows):
>
>
>body, td {
>	font-family: Verdana, Arial, Helvetica, sans-serif;
>	font-size: 100%;
>}
>
>Therefore when I set a font-size of some element as .80em the font is too small (.80 of .65 of 100% base font). So my question is,
>is it a good practice to define the font-size of body to absolute value? For example, to 14px as:
>
>
>body, td {
>	font-family: Verdana, Arial, Helvetica, sans-serif;
>	font-size: 14px;
>}
>
>
>Then by setting certain element font-size to em or REM I will be able to better define and control font sized of my pages. Does it make sense?

I think the default font size for most browsers is 16px so your 100% will be that. The advantage of using 62.5% is that this would set the default fontsize to 10px which is a nice round number for use with .em - for example 1.2em will be 12px, .5em will be 5px, etc....

Also, in general, it's not good practice to define font-size directly in px - you will be preventing users who have chosen to use a larger default font-size from achieving the effect they expect.....


Good clear description of how font-size works here : https://developer.mozilla.org/en-US/docs/Web/CSS/font-size.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform