- can div really replace tables for layout?
Generally it's worth aiming for. But for everything? No. There are common table constructs which cannot be reproduced with CSS, particularly where you are mixing fixed-pixel, font-relative and viewport-relative measurements in one table. Complex liquid form layouts are the usual case for this.
In theory you could replace <table>
, <tr>
and <td>
with divs styled as display: table-cell
et al. However this won't work in IE, and is of questionable usefulness: you are still leaking the layout concerns into the markup just as much as if it were a table. (Plus you can't do spanned cols/rows like this.)
I got myself in trouble to create a div with corners for example.
You mean with image corners? That's really easy. But the trick is not to try to do it by positioning elements. Instead, use nested divs, each with its own background. For example:
<div id="foo"><div class="left"><div class="right">
Content.
</div></div></div>
#foo { background: url(mainbackground.gif); }
#foo .left { background: url(leftborder.gif) top left repeat-y; }
#foo .right { background: url(rightborder.gif) top right repeat-y; padding: 32px; }
That gives you a left and right border image laid over the main background. You can do the same three times to get a full table-like with 8 border images, or just nest divs nine deep. You can reduce the number of divs required from 3 to 2 if you can include the main background image in one of the border images (this may require very wide images if the element may grow large). You can use padding on some of the elements if you need the border images to be transparent (ie, the main background image isn't to be rendered on the edges).
In the future, this will become much easier and remove the need for so much nested markup, thanks to CSS3's proposed multiple backgrounds per element and border images.