Live data from Hacker News

Why CSS Should Be Used for Layout

newmediacampaigns.com

31–40 of 58 posts

Re: Why CSS Should Be Used for Layout

#31
post #22

Earlier quoted context omitted.

> CssZenGarden also shows that refactoring a CSS-driven site is easier since you can do it without changing your templates. In my experience, this just doesn't happen in the real world.

I'm actually refactoring our marketing site, and most of the the work is done in CSS stylesheets. I sometime edit the markup to change classes or add the occasional . What I gain from CSS is that I can easily play with the layout and get a feel of what works best. I also code by hand. I guess table-base layout would be easier to experiment with using a wysiwyg editor.

> you can do it without changing your templates.

...

> I sometime edit the markup to change classes or add the occasional .

Case in point.

> I guess table-base layout would be easier to experiment with using a wysiwyg editor.

Christ on a cracker, if a person is using a wysiwyg, they shouldn't even be in this discussion.

Re: Why CSS Should Be Used for Layout

#32

Context-sensitive Presentation, Better Accessibility, and the most complex designs are easier with CSS. These seem to fall under the YAGNI rule. In particular, if it took me a couple of hours to build using tables versus a couple of weeks using CSS (see the Ron Garret post), the above listed benefits would be cold comfort for the wasted time. The first rule should be to get something working quickly, even if it's sub…

The jury is not still out on whether tables are suboptimal. They're easier, that's their only advantage. The rule of getting something working quickly should not increase the cost of doing it right in the future.

What's optimal depends on your objective function. For Ron Garret, it appears that his objective function was "most intuitive." When smart people are on both sides of an issue, I consider it undecided.

I personally prefer using CSS for layout, not because it is more intuitive than tables, but because I prefer to remove the table-cruft from my html. I think it makes php and rhtml files easier to read. However, in the limited freelance work that I've done, I've run into more than one client that preferred I use tables because they couldn't or didn't want to maintain their layout with CSS.

Anyway, that discussion is ancilliary to my point, which is that the benefits offered by the author aren't going to be convincing to someone who sees a 40-fold or so difference in time-to-production.

Re: Why CSS Should Be Used for Layout

#33

Earlier quoted context omitted.

> CssZenGarden also shows that refactoring a CSS-driven site is easier since you can do it without changing your templates. In my experience, this just doesn't happen in the real world.

That's not true. One of the products my team has built is a "white-label" syndication system for our content. We built that driven by CSS because it's the only way to drastically change the look and feel without touching the JSPs. We currently have at least 30 or so different looks for the same outputted HTML. As long as you attach classes/IDs everywhere and do it intelligently you can do all sorts of funky overrides…

That's different, though. You built your site with the intention of supporting multiple layouts/L&F. He's talking about refactoring a site designed one way to be laid out a different way without changing the content at all, without prior knowledge of the future layout that would be used.

Re: Why CSS Should Be Used for Layout

#34
post #2

This whole argument seems to be spiraling out of control, and I doubt a single person will change their mind either way. Things not to bother arguing about in public (since no one will change their mind): Religion Politics CSS vs Tables for layout...?

It took me all of 5 minutes to learn how to use tables back in oh... '94 or so, I remember the tutorial by some lady working for the fledgling netscape corporation. To this date - and I don't think I qualify as stupid - I haven't fully grokked the css way of doing layout, there is always the little 'clear' or some other detail that keeps me from getting it right in one go. CSS works, but it is harder than it should b…

The table tag's purpose is to host tabular data. Hence the , , and tags for column headers, footers, and body data respectively.

Cite: http://www.w3.org/TR/html401/struct/tables.html

Re: Why CSS Should Be Used for Layout

#35
post #2

This whole argument seems to be spiraling out of control, and I doubt a single person will change their mind either way. Things not to bother arguing about in public (since no one will change their mind): Religion Politics CSS vs Tables for layout...?

> I doubt a single person will change their mind either way

I changed my mind (a while back). i learned about web dev and read you should use CSS not tables. so i made some layouts with css and generally believed that.

then i found some pure css vs tables arguments here. and i decided tables are fine.

Re: Why CSS Should Be Used for Layout

#36
Ironically Joel seems to be missing something that YUI Grids (http://developer.yahoo.com/yui/grids) and Blueprint (http://code.google.com/p/blueprintcss) both allow you to reorder the content of a page. Sure it's not totally arbitrary, but it gives you much more freedom than tables.

Or you could just make your CSS render out tables (http://www.digital-web.com/articles/everything_you_know_abou...).

Re: Why CSS Should Be Used for Layout

#37
It seems illogical to me that the most complex designs are easier with CSS alone and no tables. Pragmatically, there's no room for a multidisciplinary approach?

And I must vent about the you-poor-thing defense, which was only mildly present in the article but has popped up loads of times in the discussion of the past few days.

Hockey-stick learning curves are inherent, objective flaws for software interfaces, not subjective ones that don't matter once the cretin beginners have been sufficiently shamed to overcome them. Interfaces are for humans. They should make "easy things easy and hard things possible." When they don't, there is a general feeling of malaise. Steep learning curves actively foreclose productivity and decrease user enthusiasm. Let us not forget the lessons of Kathy Sierra:

http://headrush.typepad.com/creating_passionate_users/2005/1...

Furthermore, defending steep learning curves in general puts one in poor company and makes people wary. We've all seen people defend their sunk investments in genuinely crummy systems with a zeal which, seen from the outside, is comparable only to Stockholm syndrome.

Re: Why CSS Should Be Used for Layout

#38
post #2

This whole argument seems to be spiraling out of control, and I doubt a single person will change their mind either way. Things not to bother arguing about in public (since no one will change their mind): Religion Politics CSS vs Tables for layout...?

'CSS vs Tables' already falls under 'Religion'

Re: Why CSS Should Be Used for Layout

#39
post #2

This whole argument seems to be spiraling out of control, and I doubt a single person will change their mind either way. Things not to bother arguing about in public (since no one will change their mind): Religion Politics CSS vs Tables for layout...?

emacs vs. vim.

Re: Why CSS Should Be Used for Layout

#40
post #2

This whole argument seems to be spiraling out of control, and I doubt a single person will change their mind either way. Things not to bother arguing about in public (since no one will change their mind): Religion Politics CSS vs Tables for layout...?

It took me all of 5 minutes to learn how to use tables back in oh... '94 or so, I remember the tutorial by some lady working for the fledgling netscape corporation. To this date - and I don't think I qualify as stupid - I haven't fully grokked the css way of doing layout, there is always the little 'clear' or some other detail that keeps me from getting it right in one go. CSS works, but it is harder than it should b…

Tables were not introduced until '95. I've been designing web pages since then and I went all CSS in 2001. If you were doing serious design things weren't quite so rosy as the picture you paint. Hobbyists and non-designers don't realize what designing with tables was really like. There were crazy idiosyncrasies like whitespace affecting table layout. The late 90s an incredible amount of effort was dumped into developing table-based layout techniques. Tools like ImageReady evolved to make slicing images easy, but the underlying code was an abomination. Depending on your design you end up having to have tiny cells with tons of rowspan and colspan attributes or deep nesting. Neither one of those is maintainable at all, and when you bring a template-based back-end it can get downright insane. And once you get to those kinds of designs, things aren't nearly so predictable as some seem to think. Try fixing the width of one column in a table and then predicting the width of each of the remaining columns. The table cell width computation varies frustratingly between browsers and the particular content in the cell. Even worse, this situation will never be resolved because all development effort towards advancing the state of web design is happening in CSS. The abilities you have today are what you will have forever, except new browsers may introduce bugs.

The problem with this debate so far is the oversimplification of the issues. CSS was not created to simplify a 5-cell table layout by turning it into 5-div layout. These degenerate examples aren't representative of the real-world design issues that gave rise to CSS in the first place. It's like somebody saying PHP is a better language than Haskell because "functional programming is confusing"--sure go for PHP if you just need to get something done, but if you are serious about the craft of programming than you need to look to the state of the art.

CSS is far from perfect. But people need to have some appreciation of the facilities it brings to the table (despite imperfect browser support). The capabilities are much richer than tables (in fact they are a superset in the spec), and designed to solve complex design issues across a range of devices and media. This is all achieved in a human readable and editable language. Try writing postscript out by hand some time.

Post reply on HN