Reputation: 13571
I need to build a HTML/CSS layout with the following layout
|Static Div|Content Div0|Content Div1|...|Content DivN|Static Div|
a scaled down version of my code is like follows:
<div id="container">
<div id="static_div_1"></div>
<div id="content">
<div id="item1"></div>
<div id="item2"></div>
....
<div id="itemN"></div>
</div>
<div id="static_div_2"></div>
</div>
Requirements:
I am struggling with the following issues:
Edit: Its not something tabular in nature like plain data. Assume each div is like a form in itself. Something looking like a W2. I just need scrolling in the content DIV. To make the matters worse I am not really a GUI guy.. :(
Any help will be greatly appreciated.
Upvotes: 1
Views: 404
Reputation: 16412
The CSS code you need is this:
#static_div_1, #static_div_2 {
float: left;
width: 200px;
}
#content {
float: left;
overflow-x: scroll;
white-space: nowrap;
width: 600px;
}
#content .item {
display: inline-block;
*display: inline; /* Target IE6/7 only */
width: 150px;
zoom: 1;
}
Note I have added a class "item" to each of the items inside the #content div to style them. The keys in this layout are:
You'll notice there is a space between each of the items. This is the newline space, so to avoid it, there must be no newline or space between those item divs.
I hope this results helpful to you. Best regards.
UPDATE: It now works on IE6/7. For correct setting of "display: inline-block" on these browsers notice the addition of the lines:
...
#content .item {
...
*display: inline; /* Target IE6/7 only */
...
zoom: 1;
}
Upvotes: 3