响应式页面字体用什么单位:rem

html:62.5%//10px
body:1.4rem;//14px
...

<!
doctype html> <html> <head> <title>aaa</title> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> <style type="text/css"> html {font-size: 62.5%;/*10 ÷ 16 × 100% = 62.5%*/} body {font-size: 1.4rem;/*1.4 × 10px = 14px */} p.bb { font-size: 1.5rem;/*1.5 × 10px = 15px*/ line-height:2em;/*基于字体大小的两倍高度 2*15=30px**/ } p.aa { font-size: 15px;/*15px*/} </style> </head> <body> 你好啊 <p class="bb">你好啊nnn</p> <p class="aa">你好啊nnn</p> </body> </html>

font-size rem 相比10px

line-height:2em 相比当前元素字体高度2倍

posted @ 2015-05-11 19:07  yo胡yo  阅读(466)  评论(0编辑  收藏  举报