css – em的高度是多少?

前端之家收集整理的这篇文章主要介绍了css – em的高度是多少?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我还不清楚大小的意思是什么?
我在CSS中使用了px,pt.
0.8,1.0和1.2是什么意思?
我已经看到CSS中的高度像:
身高:0.8em;或身高:1.2em;
如何计算?

解决方法

多年来“em”的意义已经发生了变化.并非所有字体都有字母“M”(例如中文),但所有字体都有一个高度.因此,该术语意味着字体的高度 – 而不是字母“M”的宽度.

我们来看一个简单的例子,我们使用em单位来设置字体大小:

<HTML>
  <STYLE>
    H1 { font-size: 2em }
  </STYLE>
  <BODY>
    <H1>Movies</H1>
  </BODY>
</HTML>

When used to specify font sizes,the
em unit refers to the font size of the
parent element. So,in the prevIoUs
example,the font size of the H1
element is set to be twice the font
size of the BODY element. To find what
the font size of the H1 element will
be,we need to know the font size of
BODY. Because this isn’t specified in
the style sheet,the browser must find
it from somewhere else – a good place
to look is in the user’s preferences.
So,if the user sets the normal font
size to 10 points,the size of the H1
element is 20 points. This makes
document headlines stand out relative
to the surrounding text. Therefore:
Always use ems to set font sizes!

More Info

原文链接:https://www.f2er.com/css/217029.html

猜你在找的CSS相关文章