首页 > 其他 > 详细

rem的用法

时间:2015-09-25 17:53:45      阅读:244      评论:0      收藏:0      [点我收藏+]

rem 是css3中的属性,ie8下不兼容。
rem是相对于根元素<html>  这就意味着我们只需要在 根目录加入以下css代码。 默认单位为16px,我们需要在用rem的时候除以16  就是rem的值。  比如字体是20px,

 20÷16 = 1.25rem即可。

@media only screen and (max-width: 320px) {
    html {
        font-size: 16px;
    }
}

@media only screen and (min-width: 321px) and (max-width: 360px) {
    html {
        font-size: 18px;
    }
}

@media only screen and (min-width: 361px) and (max-width: 375px) {
    html {
        font-size: 18.75px;
    }
}
@media only screen and (min-width: 376px) and (max-width: 384px) {
    html {
        font-size: 19px;
    }
}

@media only screen and (min-width: 385px) and (max-width: 413px) {
    html {
        font-size: 19px;
    }
}

@media only screen and (min-width: 414px) and (max-width: 480px) {
    html {
        font-size: 20.7px;
    }
}

@media only screen and (min-width: 481px) and (max-width: 540px) {
    html {
        font-size: 27px;
    }
}

 

推荐前端交流群: 群号:339840649; 群名称:html5/css3/js/jq/nodejs/div 欢迎加入~
点击加入:技术分享

扫码加入:技术分享

rem的用法

原文:http://www.cnblogs.com/Sunshine-boy/p/4838485.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!