0
点赞
收藏
分享

微信扫一扫

字体大小随分辨率大小变化而变化

夏沐沐 2022-04-02 阅读 53
javascript

字体大小随分辨率大小变化而变化

<script type="text/javascript">
    function fontSize(){
        var deviceWidth=document.documentElement.clientWidth>760?760:document.documentElement.clientWidth;
        document.documentElement.style.fontSize=(deviceWidth/76)+"px";
    }
    fontSize();
    window.onresize=fontSize;
</script>


举报

相关推荐

0 条评论