为了账号安全,请及时绑定邮箱和手机立即绑定

rem在移动端的时候具体怎么使用

rem在移动端的时候具体怎么使用

想问一下关与写移动端的时候rem是根据设计稿的长度直接除10就可以吗?(给html设置为62.5%的前提下)有什么需要注意的点吗。。没有用过rem。谢谢
查看完整描述

3 回答

?
青春无敌美少女

TA贡献4条经验 获得超4个赞

html { font-size: 20px; height:100%; width:100%;}

@media only screen and (min-width: 400px) { html { font-size: 21.33333333px !important; }}

@media only screen and (min-width: 414px) { html { font-size: 22.08px !important; }}

@media only screen and (min-width: 480px) { html { font-size: 25.6px !important; }}


查看完整回答
1 反对 回复 2016-11-14
?
寄出一片海

TA贡献8条经验 获得超1个赞

 !new function(){var a=this;a.width=750,a.fontSize=100,a.widthProportion=function(){var b=(document.body&&document.body.clientWidth||document.getElementsByTagName("html")[0].offsetWidth)/a.width;return b>1?1:b},a.changePage=function(){document.getElementsByTagName("html")[0].setAttribute("style","font-size:"+a.widthProportion()*a.fontSize+"px !important")},a.changePage(),window.addEventListener("resize",function(){a.changePage()},!1)};


引入这段js,设计图的750px = 7.5rem


查看完整回答
反对 回复 2018-06-08
?
青春无敌美少女

TA贡献4条经验 获得超4个赞

你只要把我的代码放在css文件里。。然后量到的直接除以40就可以了。加上单位rem

查看完整回答
反对 回复 2016-11-14
  • 3 回答
  • 1 关注
  • 1804 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信