Can div really override table for everything on layouts?

css, html

Solution

Your example is completely doable in basic CSS using absolute positioning inside relatively positioned element. Take a look at this:

http://www.ulmanen.fi/stuff/box.php

So, in answer to your question, divs really replace tables for layout.

And what goes for question number two; tables should be used where tables are needed: in tabular data. If you need to present something in a table, use a table. Just don't use them for layout.

Problem

Maybe there is already a question about this subject, but I couldn't find it. My question is simple, Can I use only divs on a page layout? I got myself in trouble to create a div with corners for example. ``` A_____B______C | | D E F | | G_____H______I ``` take all letters as divs with some background, while letter E is where the content is placed, and it is dynamic, so it can get any height, while the width will be 100% for whole window(there is another div as the menu floating left of that div, but I didn't consider it here). in table I did that really quick with no hack, but with divs I just couldn't. I couldn't make the height of div D and F expand correctly with divs, the rest was ok so, 1. can div really replace tables for layout? 2. can div replace tables without css compatibility-hacks? (btw, that wasn't my only problem with div and css for layouts where table did it easily)

Original source

Related problems