Welcome to WebmasterWorld Guest from 54.221.49.52

Forum Moderators: not2easy

Message Too Old, No Replies

Divs Within Tables?

Tips for using divs within tables please?

     

organic21

12:01 pm on Apr 16, 2003 (gmt 0)

10+ Year Member



Hi everyone

Moving from tables for layout to css layout is a big step
i want to get away from using tables whitin tables.
rather use divs within tables
my content, navigation is around tables
getting away from that would be a huge step that i dont want to go now

any suggestions or comments on using divs within tables, i could not think of a way to position the divs since i have used tables to position everything.

thank You all

DrDoc

8:42 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome [webmasterworld.com] to Webmaster World! :)

Now, the wonderful thing about divs and CSS is that very little positioning is needed. A simple example of a fluid layout, using only divs and CSS:

<div id="content"></div>
<div id="navigation"></div>

<style type="text/css">
#content {
position: absolute;
top: 0px;
left: 150px;
}
#nav {
width: 150px;
}
</style>

Or, if you want three columns:

<div id="content"></div>
<div id="nav-left"></div>
<div id="nav-right"></div>

<style type="text/css">
#content {
position: absolute;
top: 0px;
left: 0px;
margin: 0px 150px;
}
#nav-left {
float: left;
width: 150px;
}
#nav-right {
float: right;
width: 150px;
}
</style>

If you want other divs inside the content div it is easy to make it look good by assigning either a height or width (preferably not both), or to use absolute positioning.

Birdman

8:46 pm on Apr 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World. You will want to read Nick's CSS Crash Course [webmasterworld.com]. It will get you started in the right direction.

organic21

2:36 pm on Apr 17, 2003 (gmt 0)

10+ Year Member



Hi everyone. thanks for help btw

I have discovered all that and my main problem is that i have used tables around everything to position my website.
using absolute positioning for the divs will not work together with all the tables i have around them.

So basically speaking, i have to place the divs within the tables in order to positon them relatively to the tables.

That means i am not able to use absolute div positioning. The layout will not look the way i want it to.
I would get around all that using a css only layout, which would be a big step and i am not ready to go there yet.

My question is, if it is acceptable to use divs within tables and does it have any disatvanatges? browser cross compatibility. i checked it out yeserday and everything seems to be displayed fine in ns7, opera and ie6. i am really happy with the results.

Thank you!

Birdman

3:11 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>My question is, if it is acceptable to use divs within tables and does it have any disatvanatges?

Yes(acceptable) and no(no disadvanages).

WibbleWobble

3:12 pm on Apr 17, 2003 (gmt 0)

10+ Year Member



Why are you encasing divs within tables? I don't see the need, unless you're after code bloat for no reason. Apply the styles to the table cells, or other elements; or go tableless - don't do both, its pointless.

organic21

4:24 pm on Apr 17, 2003 (gmt 0)

10+ Year Member



tables do not provide optimal readability when using screenreaders. thats the only reason why want to use divs instead of tables with css styles, encasing the divs within tables will help me to decrease the number of tables.

Thanks birdman. thats all i wanted to know

 

Featured Threads

Hot Threads This Week

Hot Threads This Month