467,907 Members | 1,405 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,907 developers. It's quick & easy.

css and HTML layout

hello everyone
which one is better <div> or table for presentation and why please? thank you
Feb 26 '08 #1
  • viewed: 1252
Share:
10 Replies
harshmaul
Expert 256MB
Hi Divs are better. DrHoward said it best in this forum...


http://www.thescripts.com/forum/thread774468.html
Feb 26 '08 #2
drhowarddrfine
Expert 4TB
Neither.

In ancient days, people used tables for layout because it was the only thing that worked, but tables were never designed for layout and, now that there are better ways, using tables for layout is stupid (see article titled that under Howtos at the top of this page).

A <div> element is one used to provide structure to a page and group common elements together. It is never an automatic decision to use one anywhere unless it's necessary. Some pages can contain none at all.

Laying out a web page is done with CSS and the normal flow of all html elements on a page. The question of which to use, tables or divs, is not one worth asking.
Feb 26 '08 #3
I have websit about Practical CSS Layout Tips, Tricks, & Techniques.


http://www.alistapart.com/articles/practicalcss/


Best Regards,
Angkana Jivaphaiboolsak
Feb 28 '08 #4
drhowarddrfine
Expert 4TB
The article is old but contains advice that is still true today. Thank you.
Feb 28 '08 #5
TheServant
Expert 1GB
From what I have read, you cannot replace tables with CSS? I use both on my site, and I have tried to get the same control over the placement of information (and backgrounds) using CSS instead of tables, but due to lack of experience I can't just yet.

I guess what I am asking is: Can I do the same with CSS as I can with tables, and will it be better?
Feb 29 '08 #6
drhowarddrfine
Expert 4TB
What you have to do is quit thinking in "tables mode". That's what I find most people trying to do is get CSS to act like a table when a table isn't necessary in the first place.

Anything tables can do with layout, CSS can do better.
Feb 29 '08 #7
TheServant
Expert 1GB
To get something like rounded borders, you need something like tables, <div>'s or even <p>'s I think. But this is really just replacing <td>'s with <div>'s? Really, the rest it fine, I think CSS is definately better with elastic and fluid page designs, I am only struggling with the look of my content borders.
Feb 29 '08 #8
drhowarddrfine
Expert 4TB
Tables are just pre-laid out grids you are confined to. divs are not. You don't have to use the borders that come with CSS. You can create your own with an image editor like Photoshop and use it as a background image or place them along the edges.
Feb 29 '08 #9
TheServant
Expert 1GB
Tables are just pre-laid out grids you are confined to. divs are not. You don't have to use the borders that come with CSS. You can create your own with an image editor like Photoshop and use it as a background image or place them along the edges.
I do use photoshop, but to make table backgrounds. I thought CSS only allowed you to change the top, bottom, left and right border? If this is true, then you can't really do customised corners? Or can you?
Mar 2 '08 #10
Markus
Expert 4TB
I do use photoshop, but to make table backgrounds. I thought CSS only allowed you to change the top, bottom, left and right border? If this is true, then you can't really do customised corners? Or can you?
Yes you can.

markus
Mar 2 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

71 posts views Thread by tomy_baseo | last post: by
8 posts views Thread by Millissa | last post: by
3 posts views Thread by Chris Kennedy | last post: by
13 posts views Thread by David | last post: by
59 posts views Thread by phil-news-nospam | last post: by
15 posts views Thread by lxyone | last post: by
42 posts views Thread by Santander | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.