html - CSS: Floating IMGs inside floating divs -
i encountered problem , didn't find solution this. i'm pretty confused because thought simple requirement.
there following elements:
- a surrounding div#wrapper
- div#a, floating left , fixed width
- div#b, floating left (right of #a) , dynamic width
- inside of div#b there plenty of images, floating left , fixed width (and height).
depending on screen resolution there should 1, 2, 3, n columns of images on right part of screen (next div#a). instead of this, container #b aligned below container #a , uses full window width.
my alternative attempt giving #b float:right , margin-left (which greater width of #a), didn't work.
i avoid absolute positioning because height of surrounding wrapper should increase content.
to visualize i'm talking about, made following diagram: http://abload.de/img/rezeptbilder1k8lsr.png
many in advance!
this happening because..you having dynamic width div#b
...ans there plenty of images , aligned next each other...so div#b grows 100% width...when has 100% width arrives under div#a.because 100% + div#a's width cant fit in 100% wide screen..you understand???
1st solution :: may use width:calc(100% - div#a's width)
.it give div#b width equals remaining free space besides div#a
or may use overflow:hidden
in div#b...now @ first div grow take width of remaining free space single row of images , once has 100% width create row of images..but wrapper must have fixed with **overflow:auto;**
also..overflow:auto;
in wrapper introduce scroll bar when combined of div , b greater 100%
edit :: check browser supports calc() here
note::if provide try our suggestion more appropriate
Comments
Post a Comment