![]() |
Anyone want to argue CSS vs TABLES for this?
Let's say you want to GENERATE the following type of structure from 12 rows of MySQL data using PHP and a horizontal columns number that can be changed by the webmaster (set to 4 here):
http://i40.tinypic.com/m803mo.png CSS 1: As far as I know, you'd need to know the exact px width of the 'container' and then divide that by the amount of box's (columns) that are set, as well as subtracting paddings, borders, etc., which sounds really messy IMO. Uh oh, what if the person set it to 5 instead of 4? Do a bunch of math in PHP to figure out the new correct width? But then how do you set the 'container' width in your .css file to match the new width? 2: Don't use a 'container' and just spit out 12 <div>'s one after another, use PHP to put a <br> after every 4 columns, or 5, whatever is set? But you have to eventually place this into some kind of 'container' in your layout which is going to have a set width. Fuck. Tables 1: First lay down <table><tr>, then loop through the 12 rows of MySQL data placing </tr><tr> after every 4 or 5, then put </tr></table> after all that is done. Except if you check the source of the page you will have an empty <tr></tr> at the end. And then both of these become a LOT more confusing when you try to implement a template system. How do you know whether to use <br> or </tr><tr> since you don't know whether the persons page is created with CSS or Tables? |
for containing/displaying data, tables are a proper way to do it. That's what tables are for.
CSS is more of site/page structure and tables are for data containers (name/address/colors/shapes/etc) |
Quote:
For example: http://www.monstersofblog.com/port/adulttube.jpg What kind of structure do you use to place 4 in each row? Does it just push them into a new row because 4 of them reaches the exact width of the container? |
I agree with the first assesment that tables can and should be used to display data.....now for the second question: you float the video boxes and clear the float after 4 boxes.....
|
Quote:
Code:
<div class="yourcontainerdiv"> |
Quote:
|
That's a job for tables. Tables are for containing data, CSS is for layouts. Generating tables on the fly is easy.
|
Tabular data, tables. Done/done.
|
Quote:
Plus, something many people seems to ignore is that YOU CAN HAVE TABLES WITH CSS. Just use display:table (or display:table-cell, or table-row, or table-column or whatever). Thus, you can have tables and all the power of CSS at the same time. Or you can use table-layout property (although in IE8 you'll need to set auto or fixed, not inherit, which I never use, so what do I care) Seriously, there's not even an argument here |
CSS:
Code:
ul { Code:
<ul> |
Another big problem I have with css is image paths.
Let's say you have this: Quote:
Quote:
Quote:
Quote:
This is one of the areas I think the whole CSS layout thing fails, if the layout were done in Tables then you could easily have the sites URL placed into a PHP variable and then when you move the site you simply change this variable and all of the images will still work. Example: Quote:
|
|
Bump for ideas on the image path problem.
|
Quote:
/index.php /css/styles.css /img/image.jpg and in your styles.css, that's referenced in index.php your background would be: background: url('../img/image.jpg'); |
It's not even a question. As has been pointing out, tables are for data.
|
Quote:
|
All times are GMT -7. The time now is 03:55 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123