我在CSS中使用了px,pt.
0.8,1.0和1.2是什么意思?
我已经看到CSS中的高度像:
身高:0.8em;或身高:1.2em;
如何计算?
解决方法
我们来看一个简单的例子,我们使用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!
原文地址:https://www.jb51.cc/css/217029.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。