News for hackers. Stuff that matters.
Re:Why CSS should not be used for layout by GHFigs on Tuesday February 03, 2009 @12:54PM (#464327)
> because the ordering of the divs in the html affects the layout

I don't understand why people keep trumpeting this like it's a big revelation. The layout of everything depends on the order whether you use CSS or not. Floats were not intended to change this, and complaining that they don't just because tables do is apples to oranges.

If you look at the specs, the example use case for floats is floating an image element inside a paragraph. For that and many other cases, floats work exactly as intended and expected. It's only when you use floats to emulate a table-based layout without using display:table that a problem like this comes up.

Re:Why CSS should not be used for layout by gcv on Tuesday February 03, 2009 @01:58PM (#464431)
I don't understand why people keep trumpeting this like it's a big revelation.

Because the dependency on entry order makes the div's class semantically meaningless. Yes, the order in tables makes a difference, but in a table, that makes sense. With CSS, however, if I add a div with a class name like "center_column", then I expect to be able to put it anywhere in its enclosing context, and it should render in the center of that context.

CSS as an abstraction leaks, and it leaks blood. It seems that CSS-supporting designers (on this thread and elsewhere) accept this far more readily than hackers. A table is a table is a table: you expect its order to matter, so no one blinks when this turns out to be the case. CSS looks superficially like it provides a higher level of abstraction, but it (1) does not, and (2) requires considerably more effort to get right.

Re:Why CSS should not be used for layout by olavk on Tuesday February 03, 2009 @02:33PM (#464487)
By putting presentational info into a class name, you break the abstraction.
Re:Why CSS should not be used for layout by joe_the_user on Tuesday February 03, 2009 @03:28PM (#464599)
Mod up parent This gives the best critique of divs I've read. And till this morning, I favored divs as an approach
Re:Why CSS should not be used for layout by GHFigs on Tuesday February 03, 2009 @02:51PM (#464526)
You don't know what you're talking about. "center_column" illustrates that. You're still pretending that floats are tables, which they are not and never were intended to be. That's my point, and it went way over your head.
Re:Why CSS should not be used for layout by gcv on Tuesday February 03, 2009 @03:12PM (#464566)
Let me try a different class name and a more thorough example.

  <div class="article">
    <div class="author">
      John Q. Public
    </div>
    <div class="text">
      Some text goes here.
    </div>
    <div class="date">
      February 3rd, 2009
    </div>
  </div>
To me, this looks like an abstract thing. It says that an article consists of an author, text, and a date. The stylesheet should take care of rendering these elements in any layout the designer implemented inside that sheet. If the rendering breaks just because author goes to the end of the list, the abstraction leaks. It means that (author, text, date) is an article, but (text, date, author) is not.
Re:Why CSS should not be used for layout by GHFigs on Tuesday February 03, 2009 @04:34PM (#464725)
It isn't an abstract thing, it's HTML, and it behaves like HTML. That CSS styles HTML is not an implementation detail -- it is dependent on the underlying document tree, not an abstraction of it.

As I said before, floats do not change that (from the CSS2 spec): In the float model, a box is first laid out according to the normal flow, then taken out of the flow and shifted to the left or right as far as possible. Content may flow along the side of a float.

What you're asking is to be able to modify the document tree, which modifies the normal flow, and then have something which explicitly depends on the rendering of the normal flow to not change.

Re:Why CSS should not be used for layout by olavk on Tuesday February 03, 2009 @04:09PM (#464690)
You can override the ordering by using absolute positioning. It has some drawbacks though, for example you have to define sizes explicitly.

But I dont really see your point in favor of tables, since CSS is strictly more powerful in this case.

Re:Why CSS should not be used for layout by mattmcknight on Tuesday February 03, 2009 @03:50PM (#464640)
The reason people make a big deal out of it, is that people are claiming that you can use CSS to separate semantic content from the presentation, when that is not 100% possible with current design of HTML/CSS. It's not really an argument about what floats were designed to do, it's a reaction to the purist argument that layout shouldn't be in the HTML. Perhaps that's a bit of straw man, since, as you say, it's obviously false. However, there is a bit of confusion out there resulting from people arguing HTML can be kinda like XML, and CSS can handle all of the layout. It's not a good position to argue, because HTML is a primarily a presentation language, in addition to offering a few opportunities to sneak in some semantic metadata.

At least people aren't using JS to move everything around on the page any more. That really sucked.

Re:Why CSS should not be used for layout by olavk on Tuesday February 03, 2009 @05:11PM (#464781)
HTML is not a presentation language. It has historically contained a bunch of presentational elements (<CENTER>, <FONT> and so on), but they are deprecated now, and not necessary when we have CSS.