FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Using <DIV> and <TABLE> both in a layout





finlytics
HI! All,
I am creating a new website and i am trying to comeup with a 2 cols/ 3 rows layout, so i have a header/ content area/ and footer, and the content area is divided into 2 cols leftnav and content pane. The problem that i am facing is when i create the 2 cols with div, IE puts some 3px gap between the left nav div and the contentpane div, so what i came up with is to put the 2 divs in a table and that solves the problem, but what i am left with is a hybrid layout of divs and tables, is this good or bad, Does anyone have any experiences to share.

Thanks.
jawker
basically i suggest you use tools like dreamweaver, frontpage and the like so that it will be easier for you. if you would like to learn more about online things or topics, i suggest you go and check this website. it has really helped me alot. www.w3schools.com. Happy Holidays!
BearClaw
its not good to mix div's and tables. you should just stick to one or the other. if you aren't using a css file to distinguish the layout of your page its best just to use tables. also its important to make sure you declare any spatial modifiers when using tables without a css file. Such as cellpadding or cellspacing.
Summer
i dun like div , table is just perfect as u can set its width freely .
finlytics
Thanks for the responses,
Ok let me describe what i am trying to do.

--------------------------------------------------------
| header area
|-------------------------------------------------------|
| | |
| left | content |
| | \
| | |
| | |
|-------------------------------------------------------|
| footer area |
|-------------------------------------------------------|

The header area is fixed. The left and contet area are fixed in height but not
in width, also the page itselfe will have no scrollbars, the content area( DIV )
will have both the vertical and horizontal scrollbars. I am not aware of a solution for this using tables, so i started with divs i get the layout the way i want but then there is this odd 3 px gap between the left and content div so i wrap them in a table and everything is good, i have only tested this on IE, i have to see how it behaves on other browsers.

Suggestions/ opinions/ criticisms welcomed.

thanks.
BearClaw
before getting into it with tables, try putting cellspacing=0 cellpadding=0 margin=0 in the div tags to make sure that everything is set to 0.

see if that works
Marston
Summer wrote:
i dun like div , table is just perfect as u can set its width freely .
HAHAHA You can do that with div's too.

And it's ok to have tables with a stylesheet attached.

And it's ok to have both tables and div's in your page.

Rolling Eyes
shabda
Quote:
i dun like div , table is just perfect as u can set its width freely .

And then you have the guts to write a css tutorial. With css you can not only set the width of each div, but can get pixel level control.
@finlitics your probel seems to be the "box model" bug of IE. To see what it is it and a workaround for that, google for "box model hack" and box model bug
Summer
lol , but i never say div can't do this . im just saying i dun like div .
BearClaw
GAH....you must keep div's and tables seperate! Tables should not be molesting the superiority of divs!
Alie
BearClaw wrote:
GAH....you must keep div's and tables seperate! Tables should not be molesting the superiority of divs!

Without mixing divs with tables I wouldn't be able to make this design to blocks for my site....
shabda
Quote:
GAH....you must keep div's and tables seperate! Tables should not be molesting the superiority of divs!

There is nothing technologically wrong with mixing divs and tables, just that I am *philosophically* opposed to them. But once yo get hang of divs you will be wonderig how you used tables.
@finlitycs did you find out wat ur problem was?
BearClaw
Alie wrote:
Without mixing divs with tables I wouldn't be able to make this design to blocks for my site....


You could achieve your layout with either div's with a stylesheet or just tables. Granted you'd have to use compounded tables and the code for the site would be immensly long, but anytime you use tables the code is going to end up longer than it needs to be.

HARNESS THE POWER OF DIV!

This site is a very good example and is what got me into it http://www.csszengarden.com
DX-Blog
Myself I still tend to combine them from time to time, although I'm starting to use divs more and more. I guess it won't take long before I will completely stop using tables at all. After having used tables for like 8 years or so it's just kinda hard to stop using them all at once Razz.

But if you're starting out I could only advice to just start learning how to use divs.
BearClaw
Indeed...tables are fastly becomming old technology in light of CSS.

CSS just cleans the source code up so nicely. And oh the formatting options!
Me love it!

Oh yea...forgot to drop in there, if anybody needs some help using div's or CSS just drop me a pm. I'd be more than happy to help.
Related topics
What's the best way to design a site?
CSS Help...
CSS/HTML
Stories of the Net
Is CSS a replacement of tables or assisting method of them ?
Aligning coloums with <div> and CSS
Center the site with the <DIV> tag.
Can you target a <div> like a frame?
targeting <div> tags with links
phpBB: How to put google ads
Difference between <div> and <p>...?
Wanted PSD to xHTML conversion
problem with <ul> navigation
[HELP QUICKLY!] Images not filling wrapper <div> eleme
Reply to topic    Frihost Forum Index -> Webmaster and Internet -> Design Tips

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.