html - Child divs won't respond to percent height -


so working on website when came across problem of footer not staying @ bottom of container div (the footer not inside of container, placed after in html). realized because of child divs floated, had put overflow:auto on container--however, because needed children have percentage heights, had height @ 100%, , know overflow:auto + specified height = scrollbar. having min-height wouldn't allow child divs height. having both doesn't work.

i recreated problem in separate testing files, getting rid of unnecessary css (although i'm sure still remains) visualize problem without clutter. it's on jsfiddle currently. have height commented out currently, because ideally won't using it.

here's container div css:

  #container {     position: relative;     width: 70%;     /*height:100%;*/     min-height: 100%;     overflow: auto;     margin: 0 auto;     background-color:#ffda8a;   } 

and 1 of child divs needs percentage height:

.featured {   position: relative;   width: 100%;   height: 50%;   background-color:red; } 

edit: want add know why happening, rather wondering if has stumbled upon css-only way of dealing it. if can't percentages, i'll flex-boxes instead (as mentioned pinih, thanks!).

it's old question, no answer, when stuff this, should use flex boxes in end, min-height property not affect children, unless it's table, , gets mess.

you can add:

 #container {     position: relative;     width: 70%;     /*height:100%;*/     min-height: 100%;     height: 1px;     overflow: auto;     margin: 0 auto;     background-color:#ffda8a;   } 

but won't grow guess why used min-height in first place.

i have been boggling mind around while, think flex answer in case.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -