Forum Moderators: not2easy
Who can convert this into a <div> structure:
<table>
<tr>
<td>
cell A1
</td>
<td>
cell A2
</td>
</tr>
<tr>
<td>
cell B1
</td>
<td>
cell B2
</td>
</tr>
</table>
The thing is... I dont know the contents of either one of these cells. Sometimes A1 holds more lines then A2, and B2 might hold more lines then B1 and vice versa... The height of A1 should be the same as A2, and B1.height = B2.height...
I'm sure there is some guru out there who has an answer for this, but I've found that when you get into this kind of situation, where you don't know Exactly what data is going to be propigating your 'cells', then tables are the way to go.
I know I'm going out on a limb here, as I'm new to this forum and I'm probably saying something that is 'bad'... but W3 does have this to say about Tables:
"The HTML table model allows authors to arrange data -- text, preformatted text, images, links, forms, form fields, other tables, etc. -- into rows and columns of cells."
There are times where I was just spending SO much time trying to change a table into a div, even though displaying data is what a table is Suppose to do, that it wasn't cost effective.
:) Just my two cents...
#container {
width:20%;
}
.right {
float:right;
}
.one, .two {
height:20%;
}<div id=container>
<div class="right one">cell B1</div><div class="one">cell A1 </div>
<div class="right two">cell B2</div><div class="two">cell A2</div>
<div>
Any use?
<div class="container">
<div class="left">
A-1 stuff here
</div>
</div class="right">
A-2 stuff here
</div>
<hr />
</div> <-- closing container div
<div class="container">
<div class="left">
B-1 stuff here
</div>
</div class="right">
B-2 stuff here
</div>
<hr />
</div> <-- closing container div
The css:
.container {
width:700px;
}
.left {
width:350px;
float:left;
}
.right {
width:350px;
float:right;
}
hr {
clear:both;
visibility:hidden;
}
Basically, you're sticking the A-1 and A-2 divs side-by side within a container themselves. Whichever container has the most content will stretch the outer continer div fully. Then it will close, and another will begin with your B-1 and B-2 content in the same manner. (Hope that makes sense!)
You might have to play with the math there to get it right (especially for IE), but it should function just fine, for th emost part. Enough to get your started anyway :)