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

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效