javascript
html 字号 宽度 像素,JS根据设备宽度设置根节点(html)font-size字体大小
JS根據設備寬度設置根節點(html)font-size字體大小
發布時間:2020-04-10 20:28:04
來源:51CTO
閱讀:3210
作者:pmlinjian
JS根據設備寬度設置根節點(html)font-size字體大小
(function () {
document.addEventListener('DOMContentLoaded', function () {
var deviceWidth = document.documentElement.clientWidth;
document.documentElement.style.fontSize = deviceWidth / 6.4 + 'px';
}, false);
window.onresize = function(){
var deviceWidth = document.documentElement.clientWidth;
document.documentElement.style.fontSize = deviceWidth / 6.4 + 'px';
};
})();
http://baoxian.pingan.com/pa18shopnst/u/wx/product/bankCardSafe/index.shtml
https://segmentfault.com/a/1190000004189237?_ea=522147
http://caibaojian.com/flexible-js.html
http://caibaojian.com/web-app-rem.html
http://huodong.m.taobao.com/act/yibo.html
http://121.40.99.17/global/rem-phone.html
頭部像素
var scale = 1.0, ratio = 1, assetsHost = 'g.tbcdn.cn', assetsVersion = '0.5.12', isTestEnv = false;
(function() {
if (location.host.match(/(waptest|wapa)\.taobao\.com$/i)) {
assetsHost = 'g.assets.daily.taobao.net';
assetsVersion = '0.5.12';
isTestEnv = true;
}
if (window.devicePixelRatio === 2 && window.navigator.appVersion.match(/iphone/gi)) {
scale = 0.5;
ratio = 2;
}
var text = ''
+ '';
document.write(text);
})();
總結
以上是生活随笔為你收集整理的html 字号 宽度 像素,JS根据设备宽度设置根节点(html)font-size字体大小的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html新增伪类,CSS3新增的伪类有哪
- 下一篇: 何时查询2021高考成绩长春市,2020