Live data from Hacker News

Why CSS Should Be Used for Layout

newmediacampaigns.com

21–30 of 58 posts

Re: Why CSS Should Be Used for Layout

#21
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...?

My mind has change!

I was Div-only and now I think mixing Tables and Div can be good, even preferable.

"One of the problems with criticising CSS is that it's very hard to write good CSS, so pointing out problems with CSS begs the question of whether this is an indictment of CSS or one's coding ability. The problem is particularly pernicious for layout. (One indication of this is how many CSS layout tutorials there are on the web.)"

This sealed it. The tool should the servant, not a thing that always trying to learn more about. Anything that really is inherently hard to use is bad, plain bad. There's no excuse. Things that are until you learn something can be great.

I've done complicate layout in CSS and the process of trying to make it work never got easier or clearer. At a certain point, you have to say "this is just a bad way to do things".

It would be nice if CSS/html somehow added objects which had the virtues of both Divs and tables. BUT I now realize that design mantra "never use tables, always use divs" was just ideological nonesense. Not that I would always use a table but I will certainly consider both options from now on

I realize now that one of the truly evil aspect of divs is that they keep you from having localized object on your page. Want to guarantee that you will have three column on your page, good friggin' luck.

Re: Why CSS Should Be Used for Layout

#22
post #14

Earlier quoted context omitted.

You could look at the html source of csszengarden. I'm guessing it uses a bit less markup and is a bit more readable than an equivalent table based layout. CssZenGarden also shows that refactoring a CSS-driven site is easier since you can do it without changing your templates.

> 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.

Re: Why CSS Should Be Used for Layout

#23
post #5

Earlier quoted context omitted.

True, it hasn't changed my mind away from being pro-CSS. It has however, made me realize how much of a learning curve CSS must be for many programmers compared to tables, much more than I thought, so I'm less likely to debate the finer points with coders that use tables and just stick to enjoying the benefits of stylesheets for myself.

It's not about the learning curve. In my view, it's about the productivity of competent web developers and designers. Referring to the learning curve is just repeating the disputed claim that people who deny the suitability of CSS for layout are just invariably incompetent. That's an excuse. And I don't agree with ejs. I think it's an important debate because CSS layout problems are a major reason why so many people…

...disputed claim that people who deny the suitability of CSS for layout are just invariably incompetent. That's an excuse.

It's worse than an excuse. It's ignoring one basic fact. One of the best things of HTML as it was understood ten or fifteen years ago was that a lot of people (to say "everyone" would be an exageration) could write it even with a text editor. This is a part of the "democracy" of the Internet.

I think that a steep learning curve or 500+ pages standards are not a good idea for this medium.

The guy of the story about Mathematica was right in one thing: it's not good that writing graphics stuff is so difficult and "beaurocratic". There is a bunch of aficionados that take every chance to create what now is still reserved to programmers or designers because the tools have a shitty usability.

Re: Why CSS Should Be Used for Layout

#24
post #14

Earlier quoted context omitted.

You could look at the html source of csszengarden. I'm guessing it uses a bit less markup and is a bit more readable than an equivalent table based layout. CssZenGarden also shows that refactoring a CSS-driven site is easier since you can do it without changing your templates.

> 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 (learn selectors!) to change the way the pages render and seriously never touch the HTML.

You can't radically change the flow of the pages but that's not the point.

The other area where CSS driven design makes things easier is debugging or experimenting with the look and feel of the page using Firebug. It's alot easier if all of your positioning and layout is set via IDs and CSS classes because I can go in and modify properties, add properties, etc. without needing to change CSS files or edit the document inline (it's much easier to modify CSS than inline style settings). Tables make this harder to do because tables are a pain in CSS with regard to which elements take specific CSS elements.

I'm not a CSS zealot but once you learn CSS properly (and it seriously doesn't take much time if you just focus on it a bit and find someone good to mentor with a bit) it makes things so much easier, especially if you're using the same generated code across different sites requiring different look and feels.

Re: Why CSS Should Be Used for Layout

#25
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...?

My mind has change! I was Div-only and now I think mixing Tables and Div can be good, even preferable. "One of the problems with criticising CSS is that it's very hard to write good CSS, so pointing out problems with CSS begs the question of whether this is an indictment of CSS or one's coding ability. The problem is particularly pernicious for layout. (One indication of this is how many CSS layout tutorials there ar…

It changed my mind too. As for only now realising that tables really are the only easy way to do it, I guess partly we've come to accept that the web is broken thanks to IE, so it doesn't stand out as odd that layout is hard with CSS.

Re: Why CSS Should Be Used for Layout

#26
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'm pro-CSS as well, but the OP made a great point. There are many important bugs in the implementation that stop us from completely separating content from presentation, yet it's the platform with largest userbase, and all that causes. Loads of viewers competing against each other, add-ons, Javascript, tons of different technologies with the same purpose, and it gets really hard to standardize anything in this environment. I believe in the W3C. I think we need a better way to separate content from presentation, and we need less permissive standards, but that also make it easy for less techy people to use the Web. And the most used browser is incredibly buggy. So it's a mess. I would like to use CSS instead of tables, but CSS is not quite perfect yet.

Re: Why CSS Should Be Used for Layout

#27
I have to admit, I default to tables for layout (not a designer, obviously). Hopefully once all of the major browsers support CSS3 (and more specifically CSS tables), this argument will be moot. Of course, the only major browser that doesn't is IE (prior to 8), so we probably have quite a while before IE 6 & 7 disappear from general use.

Re: Why CSS Should Be Used for Layout

#28
The CSS/Table argument has been settled, and tables won (by absorption): http://www.w3.org/TR/CSS21/tables.html

The CSS standard has already conceded the point that tables can do things that pre-table CSS couldn't do. It's over. The pro-CSS side, at least in the way it is being argued (as if the IE subset is CSS, rather than the standard), is just wrong and totally out of date. They've been abandoned by CSS itself. Quite a long time ago, actually.

As for their assertions that this is for "tabular relationships between data" in the standard, who cares? Table support is implemented as certain boxes with certain behaviors. If you need those behaviors in your layout, use them. They are well defined. And since content and presentation are so darned separate, it's not like it actually hurts anything, right?

(That's a critical point. If you move all the table stuff into CSS, that's fundamentally different than using the standard table tag. That's presentation in CSS and content in HTML, exactly as it "should" be!)

Getting all huffy about the fact that somebody declared that some behavior should "only be for tables" is really missing the point. The behavior simply exists, regardless of what it was "designed" for, and if you need it, use it. Besides, just read about the table support... if you can't see how that stuff might be useful in a layout, I can't imagine how your mind works.

The CSS table support is actually pretty rich, better than the conventional table tag by a lot, or at least, more flexible.

Re: Why CSS Should Be Used for Layout

#30

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…

> learn selectors!

The grand majority of those selectors are not available in IE6, which most of us still have to support, so this is a non-starter. Nobody is arguing that we wouldn't be much better off with better CSS support. The argument is that with CSS support as it is now, most non-trivial changes to a sites design are nigh on impossible without changing the markup.

> You can't radically change the flow of the pages but that's not the point.

You know, sometimes it is.

> once you learn CSS properly

Can we quit with the "you probably don't know CSS" schtick?

Post reply on HN