使用rem单位实现布局自适应
2017-04-05 17:58
531 查看
css代码
* {
margin: 0;
padding: 0;
-webkit-overflow-scrolling: touch;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: none;
font-size: 0.6rem;
}
html {
font-family: arial;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
width: 100%;
height: 100%;
font-size: 20px;
}
js代码
var scWid = document.documentElement.offsetWidth||document.body.offsetWidth;
var initScWid = 375;
var initFontSize = 20;
$('html').css({
'fontSize': parseInt((scWid * initFontSize) / initScWid) + 'px'
});
* {
margin: 0;
padding: 0;
-webkit-overflow-scrolling: touch;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
outline: none;
font-size: 0.6rem;
}
html {
font-family: arial;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
width: 100%;
height: 100%;
font-size: 20px;
}
js代码
var scWid = document.documentElement.offsetWidth||document.body.offsetWidth;
var initScWid = 375;
var initFontSize = 20;
$('html').css({
'fontSize': parseInt((scWid * initFontSize) / initScWid) + 'px'
});
相关文章推荐
- 关于使用rem单位,calc()进行自适应布局
- 关于使用rem单位,calc()进行自适应布局
- 谈谈利用JavaScript结合相对单位rem实现自适应布局的简单而实用的方法
- 关于使用rem单位,calc()进行自适应布局
- 关于使用rem单位、css函数calc()进行自适应布局
- 移动端自适应布局之-----rem单位的使用
- 纯CSS3使用vw和vh视口单位实现自适应
- rem是如何实现自适应布局的?
- rem是如何实现自适应布局的
- rem是如何实现自适应布局的
- rem是如何实现自适应布局的
- Rem是如何实现自适应布局的?
- css判断不同分辨率显示不同宽度布局实现自适应宽度&css3 @media样式的使用
- rem是如何实现自适应布局的
- rem是如何实现自适应布局的
- rem是如何实现自适应布局的
- 使用CSS实现三栏自适应布局(两边宽度固定,中间自适应)
- Swift - 使用Auto Layout和Size Classes实现页面自适应弹性布局
- rem是如何实现自适应布局的
- rem是如何实现自适应布局的