CSS font-size property from Percent to Pixel, how?

I want to convert the font-size property value from percent to pixel

says i have this html code

     <div style="font-size: 180%;">
              <a href="http://www.example.com"> link </a>
     </div> 

How to find the equivalent value for the font size: 180%; in pixel?

thanks

+3
source share
2 answers

There is no simple answer, because the font size in percent depends on the font size of the parent block. I find this the easiest way manually, manually adjusting the pixel size by pixels in Firebug.

+7
source

. , - . , :

<div style="font-size: 16px;">
  This text has size 16px.
  <div style="font-size: 150%;">
    This text has size 150% * 16px = 24px.
    <div style="font-size: 150%;">
      Because this div is nested, the base value is now 24px. 
      font-size: 100% would mean 24px type.
      So the size of the text here is 150% * 24px = 36px.
    </div>
  </div>
</div>

, .

, , ( ), , .

, , , . HTML/CSS , , . , .

, , ? ( body), . :

body {
  font: 100% font1, font2;
}

:

body {
  font: 16px font1, font2;
}

, , .

(16px - -.)

+2

Source: https://habr.com/ru/post/1716670/


All Articles