Uhm, neither since they aren’t even the same thing? The table one
A> declaring all the TD as different widths so it’s not going to render the same… that extra 43px having to go SOMEWHERE.
B> not even pointing at the same images.
C> Declaring *** like width, align, valign, bordercolor, and background in the markup - none of which even BELONG in the markup… (some of which aren’t even valid in STRICT)
D> … and that’s before we talk about paragraphs for no good reason, double line breaks doing padding’s job…
E> without the extra padding on your LI or IMG declarations in the ‘non-table’ version you are nowhere near the same rendering. Great job of card stacking - supporting your viewpoint by omitting some details.
GREAT example of writing a table as if it was 1997. Too bad this isn’t 1997.
First, let’s get the CSS for your second one to at least TRY and match the table version - that way you don’t have your lie by omission. It’s called card stacking for a reason.
#list {
overflow:hidden; /* wrap floats */
width:890x; /* also trips haslayout, wraps floats IE */
padding-right:5px;
background:url(images/image.jpg);
border:1px solid #1C5487;
}
#list li {
float:left;
display:inline; /* prevent IE margin doubling */
padding:1.2em 0 3.6em; /* assumes 1.2em line-height */
margin-left:5px;
border:1px solid #1C5487;
}
This of course will have 1 extra PX of padding on the left side, and encounter the broken box model bug in 5.x (if you give a flying *** about 5.x being off one pixel)
Then of course, let’s make a table version written PROPERLY.
<table class="list" cellspacing="5">
<tr>
<td><img src="image1.jpg" width="171" height="300" alt="image desc" /></td>
<td><img src="image2.jpg" width="171" height="300" alt="image desc" /></td>
<td><img src="image2.jpg" width="171" height="300" alt="image desc" /></td>
<td><img src="image2.jpg" width="171" height="300" alt="image desc" /></td>
<td><img src="image2.jpg" width="171" height="300" alt="image desc" /></td>
</tr>
</table>
Oh noes, 31 extra characters of markup!?! MOST of which being whitespace… (though we could lose 16 of those if IE and FF weren’t retards about the border-spacing property)
#table {
width:898px;
background:url(images/image.jpg);
border:1px solid #1C5487;
}
#table td {
padding:1.2em 0 3.6em; /* assumes 1.2em line-height */
border:1px solid #1C5487;
}
183 bytes less CSS since our table already has our desired behavior, so that means we’d need to serve 6 pages to one user before we started saving bandwidth.
Though SEMANTICALLY the list makes more sense. Well, actually that might not be true since it’s just a bunch of images it might be most semantically correct to just have them in a div - but that hinges on what they are images OF.
Still, if your going to compare, do so apples to apples, not apples to seedling.
There’s a reason I keep this old demo of mine around:
http://battletech.hopto.org/html_tutorials/3coltable.html
… and even update it from time to time. 3 column content first 100% min-height using a table. No fatter on bandwidth than it’s DIV/CSS counterpart would be…
http://battletech.hopto.org/html_tutorials/3coldiv/fixed.html
In fact… look at the contents of the two body areas. Stripped of content the table one is 254 bytes of tags and attributes - the div based one is 231 bytes… though once you add the second wrapper our sandbag background div’s for the faux column effects you’d be right back up at the same size. (assuming you couldn’t dual-purpose body and #container)
Compare the CSS, and it’s 800 bytes for the table and 1100 bytes for the div/css one (stripping comments, but before we even think faux-columns). To make up that 300 bytes we’d have to average 13 pages served per user.
Oh, and which one needs actual browser specific hacks to even work?
There are plenty of legitimate reasons for not using tables to layout elements - we do NOT need to make up ones by propagating lies.