开发者

Make a div fill the whole page in height

开发者 https://www.devze.com 2023-04-10 23:04 出处:网络
I have a page with this structure: topbar (100% width) sidebar content i want the sidebar to fill all the rem开发者_Go百科aining space of the screen in height.

I have a page with this structure:

topbar (100% width) sidebar content

i want the sidebar to fill all the rem开发者_Go百科aining space of the screen in height.

I've tried with height: 100% in my css but doesn't work.

How can i do this? There is a way to do it using css or i have to use Javascript?


To achieve this you need make sure the sidebar's parent containers have heights of 100%, too.

So, if you have a sidebar div, you have the body container, and the html container.

html, body, #sidebar { height: 100%; }


Have you set the height of body height to 100% too? If not it won't fill up the rest of the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号