News for hackers. Stuff that matters.
Re:Why CSS should not be used for layout by alain94040 on Monday February 02, 2009 @08:29PM (#463300)
The article's argument would carry more weight if the author gave an example using tables where he changes the order without affecting the layout.

The whole point of the argument is to show that if you change the order with the CSS version, things move around. Then he goes on to show a static table. What the article really proves is that tables are not better than CSS. And CSS can do millions of things that tables can't (I'm not trying to start a troll on that topic). So I'll stick with CSS, thanks.

There is one valid point in the argument: improving CSS so that you can position elements in relation to each other by name would help. So I could say that the DIV element called "left" should be on the left of the "center" element. Right now, relative order is based on the order in the HTML source.

Re:Why CSS should not be used for layout by randallsquared on Monday February 02, 2009 @09:26PM (#463369)
"What the article really proves is that tables are not better than CSS."

Well, no. What the article shows is that, for layout, CSS has one of the same chief defects that people complained about for tables (content and presentation codependence), and that CSS doesn't even have the saving grace of allowing the content to be in the same order people read in (in Western languages, yes, yes), as tables do.

Re:Why CSS should not be used for layout by ars on Tuesday February 03, 2009 @01:24PM (#464374)
in Western languages, yes, yes

I always hated that in RTL pages all the tables get reversed, but the floats don't. It's a bad design decision IMO. I ended up creating two sets of CSS for my pages, where I reversed right/left each time I used it (float, border, margin, etc.)

I want to propose start and end (or something else? suggestions?) as RTL aware version of left/right, so margin-start: 10px; for example.

Re:Why CSS should not be used for layout by GHFigs on Tuesday February 03, 2009 @03:51AM (#463725)
This is only true if you use CSS floats in a particular way which was not foreseen when the specs were written, which is only necessary if you want a certain kind of layout and don't want to use positioning or scripting. That strikes me as a step forward from always having that codependence.
Re:Why CSS should not be used for layout by mbreese on Tuesday February 03, 2009 @03:15PM (#464569)
If this is true, then the CSS spec is bad. You should not have to require scripting to position elements. Period. If you do, then it shouldn't be called CSS, it should be called CSS/JS or some other merged acronym.

I've spent many hours tweaking a design with CSS and javascript to replicate what would have been a simple table layout. There are just somethings that CSS isn't good at, for example, it's bad a fluid column layouts. Particularly where you want to have a vertical alignment of a block line up with the bottom of the longest column. (I probably didn't explain that well...) I'm not aware of any CSS that can handle this well w/o javascript.

Re:Why CSS should not be used for layout by GHFigs on Tuesday February 03, 2009 @05:19PM (#464798)
Who said you have to require scripting to position elements? I most certainly didn't mean to suggest that. That said, CSS is not a programming language, so by nature there are things possible in combination with JavaScript that would not otherwise be possible. I think it's worth considering when attempting to go against the grain of the language, just as it's worth considering changing direction to do something the language is better equipped to deal with.
Re:Why CSS should not be used for layout by puns on Monday February 02, 2009 @08:55PM (#463336)
The strength of CSS layouts is flexibility. Yes, you need to fiddle a bit with it to make it all work, but the majority of the stuff is done in an external CSS file. Redesigning parts of a CSS site is much easier than with a table -- indeed it is almost impossible with a table in some cases because it is so static. With CSS you can change positioning and float it in another direction for example. A lot of repositioning can be done with absolute positioning, though floats are more ideal for the "core" structure.

I think the example provided in the article is good though. CSS layouts should be so trivial to do, and it's a shame they're not. Going back to tables doesn't come without a cost however.

Re:Why CSS should not be used for layout by bprater on Monday February 02, 2009 @09:25PM (#463368)
Most sites also used a backend with their own templating functionality. Often, it's surprisingly simple for a programmer to change out the look of the site by tweaking a simple template.