1

Possible Duplicates:
Why are tables bad rather than css?
Why not use tables for layout in HTML?

What's wrong about creating templates with table?

i was just trying to help someone and i got one upvote followed by few downvotes because i suggested a solution with table: How do you select half the remaining width using css?

what i suggested was:

<html>
<head>
    <title></title>
    <style type="text/css">
        TD.left
        {
            width: auto;
        }
        TD.main
        {
            width:1000px;
        }
        TD.right
        {
            width: auto;
        }
    </style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="left">&nbsp;</td>
    <td class="main">&nbsp;</td>
    <td class="right">&nbsp;</td>
  </tr>
</table>
</body>

Community
  • 1
  • 1

6 Answers6

2

Tables aren't that great for layout. They are easy, but often you will spend more time trying to remove the space and get it just right. Learning to use floats and positioning will make future development really easy.

Look into the 960 Grid System. It's a quick and dirty CSS grid layout system that allows you to quickly knockout layout tasks that normally take a lot of time, plus they will reduce your overall CSS file size because you are able to use the same shared classes.

Seth
  • 6,240
  • 3
  • 28
  • 44
0

It is best practice to use css for layout. Using tables for layout is considered the old way of doing things. Tables were created for situations where you need to display data in a table format. A while back, developers started using them for page layout but we have since moved on and now use css to achieve much better results.

BumbleB2na
  • 10,723
  • 6
  • 28
  • 30
0

Usually when someone wants a template using CSS they explicitly do NOT want to use tables. CSS in a large part is supposed to make using tables to lay stuff out unnecessary.

Abdullah Jibaly
  • 53,220
  • 42
  • 124
  • 197
0

Tables are good to display large amount of data formatted in rows and columns.

For website layouts the use of other elements is preferred, for example divs, because you don't need a table, tbody and tr tags, and you they aren't styled by default by browsers, if not only for margins or paddings. So you can easily move them and style them appropriately, and you will write less code also.

Edit

I don't like to separate tables from CSS like I'm reading here, if you use tables you can still style them using CSS. They can be styled the same way as other elements, you could also do other elements acting like tables for that matter. It's just that they need more elements surrounding them and so are less freely disposable.

Jose Faeti
  • 12,126
  • 5
  • 38
  • 52
0

Thats pretty fast answered. Tables were used(for layouting) before CSS was somehow broadly supported by webbrowsers.

  • Tables consume more space
  • DIVs are more flexible for future layouts
  • DIVs are better parseable by search engines

The intended use for tables is row wise representation of strucutral data.

fyr
  • 20,227
  • 7
  • 37
  • 53
0

Using tables for the layouts is a bad idea:

  • More HTML code
  • More CSS code
  • More time to make it Cross Browser
  • Not flexible at all

I would use table just for display data, like a grid

AlexC
  • 9,657
  • 17
  • 64
  • 98