1

Code:

<div style="font-size:12px">abc</div>

On my chrome browser, the height of this div is 14px, which means the actual value of line-height of the div is 14px. How about on other browsers? Does W3C standard address this?

Pete
  • 57,112
  • 28
  • 117
  • 166
Jiale Wang
  • 131
  • 8

3 Answers3

0

The line-height for div elements defaults to a user agent value of normal. According to MDN, the interpretation of normal is user-agent dependent.

https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#values
normal Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly 1.2, depending on the element's font-family.

connexo
  • 53,704
  • 14
  • 91
  • 128
0

Your example is 14.4px height on firefox. On Safari it's 14px.
https://www.w3schools.com/cssref/pr_dim_line-height.asp

https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
line-height:normal
Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly 1.2, depending on the element's font-family.

Also usefull: http://smad.jmu.edu/shen/webtype/lineheight.html

Atomkind
  • 341
  • 2
  • 11
-1

I found one blog related to line-height with other height references in HTML/CSS. LINE-HEIGHT

Hope this will help you to understand the concepts of line-height.