I want to make a div 100% height, so basically the full screen. This, so that the background streches over the whole page. I don't want to add the background to the body, since i want it so that if i comment out the wrapper, the page is full width. (which works by the way)
So basically my question is: how can i make the wrapper-bg div 100% high.
Hope you guys can help me.
Try with .wrapper-bg {position:fixed; top: 0px; bottom:0px}
html,body{height: 100%}
Make sure that your parent element has height 100% and it should be positioned as relative. Try making it absolute. Your child div strech to parent height.
将主体高度设置为100%,因为div宽度或高度仅在将父代设置为某个值时才适用,例如,如果主体100%div高度为100%将起作用,则确定父代
Try this, should work as you have to make all parent elements 100%.
html, body {height: 100%}
.yourdiv {height: 100%}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.