Which is best to use to layout a website?

I know that ideally both are used together but recently i have came across many examples where html tables are used and arranged to contain elements and control layout.

Just wondered if using html tables for website layout is effective in your opinions? as well as or separate to using css commands such as float: etc?

Thanks

The generally preferred method is to separate content from style unless the content would logically be presented in a table.

That said - sometimes using tables to tightly control elements is the only way to go.

For myself - I position elements using css unless it's tabular data. I don't mind if a page looks different from one browser or monitor to another as the content is more important. But I do try to make sure that it doesn't actually break.

For me using html and css together is best .
It has lot of advantages
A single CSS file can contain positioning, layout , font, colors and style information for an entire web site. The file can be referenced by each html file on the site.

Thanks for the replies.

Think i might experiment with each path. I'm creating a dynamic website but i want it to appear the same on all browsers and screen resolutions and i've always had problems with doing that.

Depending on how complex your design is - and how dynamic, getting it to look exactly the same may not be possible. But you can get close.

It's not a question of either or. Tables for whole page layouts are strongly discouraged in today's web standards. Tables for tabular data is using tables for what they were meant to do. You can read more about why tables for layouts are bad here.

With that said, dynamic pages are created using content pulled from databases. Many times the use of tables are fully warranted in this type of presentation. For instance: you have a page that displays products you are offering site visitors.

Even then CSS, which is how CONTENT is styled regardless of whether its div based or table based, can be used to style your page(s). The w3c.org says that separating content from presentation is the correct and semantic way of web design.

Tables are not used as layout, since the 90s. they were the tool then only because there was nothing else
tables as a layout tool are 80% layout 20% content, the page becomes huge, slow, difficult to edit, every page must contain the full table
css layouts are smaller, simpler to maintain, the layout is downloaded once, in the style sheet, the page is 80% smaller = 500% faster to load

even with data from a db, dynamic pages, css layout is easier to construct, maintain, and design, tables to present the information, tables have that ideal use, for tabular data,

there are still sites laid out in tables,
alligators are the remnants of dinosaurs, the same reason, too stupid to die out.

From the above comments it is clear that content is to be written in HTML and the styling is to done in separate CSS file.
It is not recommended to use table in HTML until required to be shown in tabular way.
Well done guys.

I like CSS for its advance facilities. CSS is really smart.

Use DIV for page layout design and use Table for inside things e.g Forms etc

DIVs are preferable and little weight than tables.

Thanks

use css for the convinent way to design your site

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.