1.html页面入口函数加入下一段,获取屏幕宽度/10,得到基数。
window.onresize = function (ev) {
$('html').css('fontSize',(document.body.offsetWidth / 10) + 'px')
}
2.使用pxCook https://www.fancynode.com.cn/pxcook 工具打开psd,使用上面获取到的基数填入到 pxCook工具中,获取对应的width、height 都为 rem,即可实现自适应
ps:前端小哥哥推荐!