By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,446 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,446 IT Pros & Developers. It's quick & easy.

css and HTML layout

P: 14
hello everyone
which one is better <div> or table for presentation and why please? thank you
Feb 26 '08 #1
Share this Question
Share on Google+
10 Replies


harshmaul
Expert 100+
P: 490
Hi Divs are better. DrHoward said it best in this forum...


http://www.thescripts.com/forum/thread774468.html
Feb 26 '08 #2

drhowarddrfine
Expert 5K+
P: 7,435
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

P: 15
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 5K+
P: 7,435
The article is old but contains advice that is still true today. Thank you.
Feb 28 '08 #5

TheServant
Expert 100+
P: 1,168
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 5K+
P: 7,435
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 100+
P: 1,168
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 5K+
P: 7,435
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 100+
P: 1,168
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 5K+
P: 6,050
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.