关于Web字体

By admin, 10 十二月, 2015

如果要指定一个DIV宽度容纳5个字,用width: 5em而不要用百分比,百分比是相对于屏幕宽度,而em是字的宽度。

如果指定div的width:10%; height: 10%,并不代表这是一个正方形,因为width是相对于屏幕宽度,height是相对于屏幕高度;如果用em就可以基于一致的尺寸。

一般来说,对于body,1em=16px。

<body><div style=“font-size: 2em”><div sytle=“font-size:2em”>这里相当于4em,64px</div></div></body>

不要认为%可以解决一切的事情。字体的尺寸和屏幕尺寸无关,字体即使用%,也是基于16px的倍数。

对于字体尺寸200%即2em。

评论

Restricted HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <img src>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。
验证码
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
请输入"Drupal10"