I am trying to get a div container that will scroll horizontally outside the viewport. It looks like a fullscreen filmstrip with #a
at the beginning and #c
at the end. Both #a
and #c
are fixed div widths, and #b
has a dynamic width image. The problem I am facing is that #container
dynamically change its width to accommodate #b
. Setting the width of #container
to auto or 100% uses only the width of the viewport.
What I need:
[- viewport width -] --
My markup:
#container { height:400px; } #a { float:left; width:200px; height:400px; } #b { float:left; width:auto; height:400px; } #c { float:left; width:200px; height:400px; } <div id="container"> <div id="a">fixed width content</div> <div id="b">dynamic width content</div> <div id="c">fixed width content</div> </div>
Edit: I can do this using a table, but would like to avoid this if possible.
Edit 2: Here is the working version using tables:
#container { height:400px; background:#fff; } #a { width:200px; height:400px; background:#ccc; } #b { height:400px; background:yellow; white-space: nowrap; } #c { width:200px; height:400px; background:#ccc; } <table cellpadding="0" cellspacing="0"> <tr> <td id="a"> a </td> <td id="b"> <img src="..." /> <img src="..." /> <img src="..." /> </td> <td id="c"> b </td> </tr> </table>
source share