HTML default font size

I wonder what the default font size is html and I can not find the answer.

What I mean:

What is the font size in pixels corresponding to this:

html { font-size: 100%; } 

It would be helpful to know this if you need to calculate rem font sizes.

+8
html css
source share
4 answers

The default is 16px.

If you create an HTML file with any text in it, open it in Chrome, you can check the calculated styles.

enter image description here

+10
source share

There is no specific font-size default value in the W3 CSS spec except for the relative medium value.

As they say, a quick test with versions of the developers of IE, Firefox and Chrome shows that the de facto standard is 16 pixels. I would be interested to see how someone is testing this on mobile versions.

Edit: as of 2017-03-20, stable versions of Chrome, Firefox, Edge and IE on the desktop, as well as Chrome, Firefox and Opera on mobile devices, the default is the de facto 16px standard for font-size .

+10
source share

Live demo

Here is an easy way to check:

HTML:

 <p>Hello world</p> <span></span> 

JQuery

 $('span').text("Font-size is: "+($('p').css('font-size'))); 

Screen Output:

 Hello world Font-size is: 16px 
+6
source share

The default value is browser dependent. In fact, this is the very reason for using the rem block. If we knew that the default was 16px , for example, using rem would make little sense.

As the other answers describe, the general factory default parameter in browsers is 16px . This can be changed by the user in the browser settings. In some browsers, you can set the size of any number in pixels, while in some browsers there are several alternatives described verbally. In addition, the default font size can also be set in the user style sheet.

+3
source share

All Articles