How to change the “html” element's CSS

前端 未结 3 1330
日久生厌
日久生厌 2021-01-29 02:11
html {
    width:100%;
}

How to change the CSS of the html tag dynamically on clicking the button using JavaScript? I mean I want to make

3条回答
  •  抹茶落季
    2021-01-29 02:31

    There's probably a simpler way, but

    htmlTags = document.getElementsByTagName("html")
    for(var i=0; i < htmlTags.length; i++) {
        htmlTags[i].style.overflowY = "hidden";
    }
    

    Hope I remembered everything right.

提交回复
热议问题