html - CSS : Make to sibling divs have the same height, relative to page -


i constraint 1 div take same height sibling div have variable content. additionally, want both divs have min-height of 100% of window's size.

here jsfiddle : http://jsfiddle.net/m5q38/1/

the problem that, use min-height on divs, requires parent container have specified height, can't fix. , if use height: 100% on divs, take height of window, including when content of #container div large div , overflow.

alternatively, if don't use min-height , #container div has less content, div won't take whole window's height :

like so

(here fiddle other try : http://jsfiddle.net/m5q38/3/)

does know how solve ?

to make simple want :

  • the green div fit content
  • the green div have min height of 100% window
  • the blue div have same height of green div.

thanks helping !

if can use jquery, see fiddle , note commented out css

using jquery:

$( function() {     $('#left-bg').height($('#container').height()) }); 

setting consistent div height interesting problem. in past, when i've had multiple sibling div elements wrap them in on div , set each div css display:table-cell , works nicely keep heights equal regardless of div content.

not sure can use here have positioned elements


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -