【公式转换】px to em

  • Convert pixels to ems using the formula target ÷ context = result
  • Use the default browser font size of 16px as the context unless otherwise specified

例子:

 1 <!DOCTYPE HTML>
 2 <html lang="en-US">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title></title>
 6     <style>
 7         h1{
 8             font-size: 24px;  /* 1.500em  24px/16px */
 9         }
10         h1 a{
11             font-size: 18px;  /* 0.750em  18px/24px */
12         }
13     </style>
14 </head>
15 <body>
16     <h1>Smells Like Bakin <a href="#">taste really delicious</a></h1>
17 </body>
18 </html>

 

posted @ 2013-03-20 20:59  KOJYA  阅读(372)  评论(0编辑  收藏  举报