PDA

View Full Version : Table alignment issue



trailo77
06 Apr 2011, 06:18 AM
Hi am trying to get multiple tables with different number of columns to be aligned properly.

I'd expect the columns width the same width of both tables to be align properly. But they are not, as you can see on the picture at the bottom of the page. The first two columns look good, but the more columns I add the more shrewd up the result gets.

Does anybody know how to get them properly aligned ?

Of course it works if the width is given in px not in %, but that is not what I want to do.
Using a single table and colspan is also not an option, as this is a simplified example of the problem.

Thanx in advance.



<html>
<body>
<style type="text/css">
.width100pro {
width: 100%;
}

.c1-6 {
width: 15%;
}

.c1-12 {
width: 5%;
}

.t1 {
width: 35%;
}

.t2 {
width: 65%;
}

.b25 {
width: 25px;
}

.b100 {
width: 100px;
}
</style>
<table class="width100pro">
<tr>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td class="c1-6"><input value="TestBig" class="b100"></td>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td class="c1-6"><input value="TestBig" class="b100"></td>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td class="c1-6"><input value="TestBig" class="b100"></td>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td><input value="TestBig" class="b100"></td>
</tr>
</table>

<table class="width100pro">
<tr>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td class="c1-6"><input value="TestBig" class="b100"></td>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td class="c1-6"><input value="TestBig" class="b100"></td>
<td class="c1-12"><input value="TestSMall" class="b25"></td>
<td><input value="TestBig" class="b100"></td>
</tr>
</table>
</body>
</html>



http://www.htmlforums.com/attachment.php?attachmentid=11382&d=1302083641