简体   繁体   中英

Stretch floating child to 100% height of parent?

Is this possible using CSS only? I can't find a definitive answer anywhere!

It's for a left and right nav bar I'd like to stretch to 100% height; ie the end of the page. There are three floated columns contained within a floated container that stretches 100% height, I just can't get the childs to stretch...

http://www.dev.inside-guides.co.uk/brentwood/pages/links.html

Thanks in advance for any replies.

I had this problem before. Try adding:

html{
 height:100%;
}

Make sure the parent div has a set height and the div itself is also height:100%;

If you have any trouble let me know :)

It can be done, if you set its parent div container position to relative as follows

#container {
    position: relative;
}

and then set the div you want to be 100% and position absolute as follows

#inner {
    height: 100%;
    position: absolute;
}

this is how I've done it, hopefully I haven't missed anything :)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM