Search code examples
csshtml4

What is the default unit if the specified font size has none?


I'm converting HTML4 to HTML5, and I have this:

<font face="Verdana" size="2">

The above is no longer supported in HTML5. What value and unit does the font size above map to in CSS?


Solution

  • So the Font tag had 7 degrees of freedom. You can specify a value between 1 and 7. 7 is largest and 3 is default

    Font Tag

    In CSS you have the font-size property, also 7 degrees of freedom, the constants for it are not numeric, and medium (which is the 3rd value) is the default.

    FONT Tag   font-size CSS
    N/A             xx-small         
           1          x-small           
           2          small              
           3          medium          (default values)
           4          large              
           5          x-large           
           6          xx-large         
           7          N/A                 

    CSS font-size Property

    So if you consider that the default values do not match up exactly betewen both standards, then we can assume that the standards are slightly different, without 1:1 mapping or meaning. Your value of 2, might be small and it might not. I do think that is probably is small though.

    You will discover that other factors are coming into play with CSS, and you will generally discover other discrepancies that prevent a direct conversion between the Font tag and the CSS properties. You might be safe on this one, though, as these values are defined as "absolute sizes".

    see: It Depends see: Size to px