Tuesday, March 11, 2008

css and tables

Css is great.
What a great concept. Separate content from design.

I started trying to learn css more today with regards to laying out an html document. Yesterday, I thought I had made a good page using css, until I viewed it in Internet Explorer.

Redoing the site was kind-of a nightmare, (first of all i'm not a css expert..yet, and trying to juggle the browser compatibility was hard. (Thanks to a friend who helped explain some css techniquess to me... redoing the site wasn't as hard as it could have been)

People say css replaces tables for layout
csszengarden.com at first convinced me of that.

However, I am not completely convinced any more. It may be too soon for me to blog about this but I don't completely buy the with css you can "separate content from design."

I found myself having to think of the layout of the site and then change the hierarchy of my div elements accordingly.
I also at at least one point had to put a div inside another div.
That doesn't sound like separating content from design but rather complicating your content to meet your design needs.

I imagine, with the complex and complicated use of "position:absolute", you can organize your document in whatever way you want, without regard to the hierarchy of the div elements.

sounds good...

But then if you are still having to think of the hierarchy of your divs in your content, aren't you better off just using a table with each cell as a div element. That table will be your default design, and if you want to change it you can "position:absolute" the divs and change the order.

however...

for simple things like a two column setup you can use a float and not worry about using a table.
I like this example
also...

In IE you cant do "display: table-cell".
(if you want to do things like vertical align or make a div only as wide as it needs)
(I don't know of any other way to do it)
You need an actual table to do that.

No comments: