动态调整font-size

 

              document.addEventListener('DOMContentLoaded', () => {
                  const html = document.querySelector('html')
                  let fontSize = window.innerWidth / 10
                  fontSize = fontSize > 50 ? 50 : fontSize
                  html.style.fontSize = fontSize + 'px'
              })

 

posted on 2019-10-14 10:04  jzfan  阅读(374)  评论(0编辑  收藏  举报