Make navigation bar take up entire page height in css

后端 未结 5 1724
梦谈多话
梦谈多话 2021-01-13 01:04

I am designing a website using css and html. I have managed to get a navigation bar on the left side of my page using this css, however when the screen is scrolled down the

5条回答
  •  再見小時候
    2021-01-13 01:39

    Using only HTML and CSS you can usually fix this 100% height issue by using:

    body,html{
       height:100%;
    }
    

    If you want to use the JavaScript method then this should work

    document.getElementById("navbar").style.height=window.innerHeight;
    

    That will set the height of the navBar element to whatever the height of the browser window is

提交回复
热议问题