移动端兼容适配js+css全局样式

mac2022-06-30  92

这是研究了淘宝和拉钩以及网易的兼容全局样式后,提取的兼容样式,经过实战可用

css全局样式

@media screen and (max-width:321px){ body,html{font-size:15px}}@media screen and (min-width:321px) and (max-width:400px){ body,html{font-size:16px}}@media screen and (min-width:400px){ body,html{font-size:18px}}js全局样式1.当设计稿是750px的时候,设置值为3.75时:  1px=0.01rem;全局用的时rem单位 var deviceWidth = document.documentElement.clientWidth;if(deviceWidth > 750) deviceWidth = 750;document.documentElement.style.fontSize = deviceWidth / 3.75+ 'px';

转载于:https://www.cnblogs.com/937522zy/p/9566469.html

最新回复(0)