News for hackers. Stuff that matters.
Re:Why CSS Should Be Used for Layout by ejs on Tuesday February 03, 2009 @01:31PM (#464391)
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...?

Re:Why CSS Should Be Used for Layout by joe_the_user on Tuesday February 03, 2009 @03:24PM (#464591)
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 by anc2020 on Tuesday February 03, 2009 @03:49PM (#464635)
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 by joe_the_user on Wednesday February 04, 2009 @01:25AM (#465343)
I would like to also say that the failure of CSS/Div is kind-of discouraging. Within the history of html, tables were intended for tabular data. The ideal of divs is to have an element that is specific to layout rather a tag for tabular data that one just happens to use for tabular.

Html, in general, is a messy. Html is one of the most amazing programming success stories, in the sense that it is the widely programming language by non-programmers. SIMPLE html created the web. Html that is that was so simple that the friggin w3c standards would never accept it now.

And the "progress of standards" has essentially only made this mircle lousier. You could blame corporations but it really seems like simple bureaucracy was just as much to blame.

Re:Why CSS Should Be Used for Layout by alabut on Tuesday February 03, 2009 @02:12PM (#464448)
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.
Re:Why CSS Should Be Used for Layout by fauigerzigerk on Tuesday February 03, 2009 @02:23PM (#464469)
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 use Flash. My own opinion about this matter is not cast in stone. I may change my mind based on good examples of CSS layouts that don't break and actually make maintainance easier.

Re:Why CSS Should Be Used for Layout by narag on Tuesday February 03, 2009 @03:40PM (#464617)
...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 by cedsav on Tuesday February 03, 2009 @02:48PM (#464520)
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.

Re:Why CSS Should Be Used for Layout by Erwin on Wednesday February 04, 2009 @11:44AM (#465968)
To be so CSS-styleable, CSS Zen Garden uses multiple layers of DIV in DIV in DIV all over the place. Hardly better than table. Also this gem:

      <div id="extraDiv1"><span></span></div><div id="extraDiv2"><span></span></div><div id="extraDiv3"><span></span></div>
      <div id="extraDiv4"><span></span></div><div id="extraDiv5"><span></span></div><div id="extraDiv6"><span></span></div>
Re:Why CSS Should Be Used for Layout by chairface on Tuesday February 03, 2009 @03:06PM (#464557)
> 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.

Re:Why CSS Should Be Used for Layout by SystemOut on Tuesday February 03, 2009 @03:41PM (#464622)
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 by chairface on Tuesday February 03, 2009 @04:09PM (#464692)
> 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?

Re:Why CSS Should Be Used for Layout by hrabago on Tuesday February 03, 2009 @04:42PM (#464736)
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 by cedsav on Tuesday February 03, 2009 @03:32PM (#464605)
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 <div>.

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 by chairface on Tuesday February 03, 2009 @04:12PM (#464698)
> you can do it without changing your templates.

...

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

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 by KrisJordan on Tuesday February 03, 2009 @02:51PM (#464527)
Saying "CSS is a better solution than Tables for reasons [X,Y,Z] but it is at the cost of a higher learning curve," is much different than saying "CSS is a better solution than Tables for reasons [X,Y,Z] but you're too incompetent to understand."

CSS layout problems are not why so many people use Flash. Flash has popularity because for pure designers working in a GUI on a canvas where you can pixel place every item with drag-and-drop is natural and taught in school.

As for examples, the article calls out the canonical CSS layout example site made specifically for this purpose years ago: http://csszengarden.com/

Re:Why CSS Should Be Used for Layout by palish on Tuesday February 03, 2009 @02:23PM (#464470)
Great! I think the internets would be a better place if more people embraced "be quiet and enjoy it for myself". If other people are missing out, oh well. That's a competitive advantage.

It seems like people on both sides of this debate are seeking validation rather than trying to help people.

Re:Why CSS Should Be Used for Layout by llimllib on Tuesday February 03, 2009 @02:26PM (#464474)
Partisanship has benefits, and I hope people aren't being quiet and enjoying awesome things that I don't know about.

Fight for what you think is right!

(Disclaimer: I'm not advocating for senseless opposition; rather for reasoned partisanship and against "be quiet and enjoy it for myself".)

Re:Why CSS Should Be Used for Layout by jacquesm on Tuesday February 03, 2009 @03:17PM (#464576)
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 be, the idea of something new superceding something older is that it is better and easier to use at the same time.

If CSS was really that great we wouldn't be having these debates, people would have switched en masse years ago and the 'table' tag would have been deprecated. I think any such attempt by w3c would be met with a fairly serious revolt.

Re:Why CSS Should Be Used for Layout by dasil003 on Tuesday February 03, 2009 @06:50PM (#464973)
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.

Re:Why CSS Should Be Used for Layout by ja2ke on Tuesday February 03, 2009 @07:42PM (#465042)
I still generally code in tables, but I agree with this. The flexibility of design, and the design possibilities available to the guys in my office who use CSS, are far beyond what I can accomplish with a table or mixed table/CSS design, unless I seriously hack the shit out of my page, which makes the coders go bananas.

It's definitely a transition to go from the table mentality of basically stretching the page out like a weird balloon from the top left corner or top center of the page, to the CSS mentality of having to sort of "press in from the outside" to keep things from blowing up all over the page and each other, but the more I learn about how web stylesheets work, the more I respect them.

CSS fans often cite the fact that the code looks cleaner or that the data is more modular, etc. I don't really think that's the case, at least not when compared to a table driven site which also just has a lot of class and ID tags for background images, text colors, which in practice is just as flexible. CSS shines though where it allows you to create things in sizes and configurations just not possible in tables without a lot of shitting all over yourself (the biggest one being having two elements overlap, which is useful for drop down menus, confirmation boxes, etc, etc.)

Re:Why CSS Should Be Used for Layout by joe_the_user on Wednesday February 04, 2009 @01:36AM (#465351)
"Hobbyists and non-designers don't realize what designing with tables was really like."

Uh, designers might not realize that programmers have to generate and modified HTML, not just hand-craft it.

I do really do appreciate that Div/CSS have many, many aspects that are a step forward.

But the limitation that have been incorporated into CSS are just worse the "imperfect", they have screwed the ability to produce exact, reproducible results.

The ultimate solution is something beyond both present CSS and tables.

"Try fixing the width of one column in a table and then predicting the width of each of the remaining columns." -- Yeah, but I can predict that each item on the row will be on the same line. Divs are harder than that.

Well, we can go on but I swear I've learned something and I was a div proponent till today.

Re:Why CSS Should Be Used for Layout by dasil003 on Wednesday February 04, 2009 @03:15AM (#465440)
Uh, designers might not realize that programmers have to generate and modified HTML, not just hand-craft it.

Yes, and this is one of the areas where tables can get really nasty really quickly.

But the limitation that have been incorporated into CSS are just worse the "imperfect", they have screwed the ability to produce exact, reproducible results.

My point was that the idea that tables produce exact reproducible results is flawed. They just are more straightforward at the very basic level.

The ultimate solution is something beyond both present CSS and tables.

It's a nice thought, but god is not going to come out of the sky and simultaneously upgrade everybody to the something better.

People complain about all the flaws of CSS and the slow pace of progress, but seriously, considering this is the first truly cross-platform, cross-medium technology in the history of mankind, and looking at where we were in 5 year increments (2004, 1999, and 1994), progress is doing just fine.

Another thing... it's easy to pick apart CSS. But the domain of problems it has to address is HUGE. It's much more complicated than any one individual can fathom. No one is going to be able to turn around and create something that solves all the problems without being extraordinarily complex.

Yeah, but I can predict that each item on the row will be on the same line. Divs are harder than that.

CSS does have a learning curve, but it's not bad for what it actually provides. 90% of the hassle is just browser issues (which are getting better all the time). And FWIW, CSS supports table layout rules as well as float and absolute positioning, browser support just needs to catch up.

Re:Why CSS Should Be Used for Layout by braindead_in on Tuesday February 03, 2009 @06:53PM (#464980)
Or try learning latex!
Re:Why CSS Should Be Used for Layout by KrisJordan on Tuesday February 03, 2009 @05:11PM (#464780)
The table tag's purpose is to host tabular data. Hence the <thead>, <tfoot>, and <tbody> 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 by nx on Tuesday February 03, 2009 @03:56PM (#464653)
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 by xenophanes on Tuesday February 03, 2009 @05:11PM (#464783)
> 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 by joshwa on Tuesday February 03, 2009 @02:36PM (#464494)
Canon vs. Nikon ;)
Re:Why CSS Should Be Used for Layout by Devilboy on Tuesday February 03, 2009 @05:59PM (#464882)
'CSS vs Tables' already falls under 'Religion'
Re:Why CSS Should Be Used for Layout by newt0311 on Tuesday February 03, 2009 @06:19PM (#464930)
emacs vs. vim.