码迷,mamicode.com
首页 > Web开发 > 详细

CSS设置文字大小自适应功能

时间:2014-12-01 19:10:39      阅读:272      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   sp   strong   on   div   log   bs   

<span id="topaccount" style="font-size:3rem;color:red;">NANA</span>&nbsp;<span>

这是html的某一个页面的span里面的东西

我想让它自适应显示设备儿变大变小font-size:3rem

1rem=16px

然后 我只要设置html的属性,然后具体哪个标签要固定死就让他为固定的值。其他的值为3rem的百分比

<style>
@media screen and (max-width:1255px){
    html{font-size:85%;}
}
@media screen and (max-width:1280px){
    html{font-size:75%;}
}
@media screen and (max-width:768px){
    html{font-size:50%;}
}
@media screen and (max-width:640px){
    html{font-size:45%;}
}
@media screen and (max-width:480px){
    html{font-size:35%;}
}
@media screen and (max-width:320px){
    html{font-size:20%;}
}
</style>

CSS设置文字大小自适应功能

标签:style   blog   color   sp   strong   on   div   log   bs   

原文地址:http://www.cnblogs.com/JAYIT/p/4135731.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!