Re: CSS aims

The real question here is: “Does HTML really represent a good way to define a layout?”


CSS was initially defined as another way to express the formatting and layout tools defined in the HTML specification, that’s true. But if you think about every recent talks I’ve seen about CSS 3, if flexbox or grid was mentioned, the talk also included a line saying “we can do real layout in CSS now”, which kinda implies everything that did exist before was a hack.


HTML is born to define structured content. Headings. Paragraphs. Floats. Tables. If you think about it, those are the kind of things you can find in a word processor, not an application that define layouts like Publisher or Reflow. There has been a time where HTML evolved to include some layout concepts like <center>, but now we are in the Semantic HTML world, those have been deprecated.


The langage of a layout structure is boxes. Block boxes, for sure. Flexible boxes, yes. Grids, of course! This is not the language of HTML, and this will probably never be. CSS could.



For now, we have something like that:


    * { content: slot(before) contents slot(after) }

    

What if we could define templates instead? 



I believe a new “HAML” whose tags would represent the box display type is the thing we’re looking for.


   @template weird-template {

       

       #before-wrapper[color=red] {


           #before-wrapper-marker[display: inline-block; content: ”⨯”];
           [content: contents];
       };

       

       #content-wrapper[display=block; width=100px] {


           #content-wrapper-marker[display: inline-block; content: ”⨯”];
           [content: contents];
       };

       

       #after-wrapper[color: blue];

       

    }


    #SomeElement { content: template(weird-template); }


or something like that would be much better to express layout than HTML can possibly be.



HTML has diverged apart from the layout needs, to concentrate only on semantics and content. HTML is only used for representing the layout structure because nothing else exist. I think the future of CSS is to provide a better alternative.


But that’s just a point of view, of course ;-)

François









De : Alan Stearns
Envoyé : ‎mardi‎ ‎14‎ ‎janvier‎ ‎2014 ‎20‎:‎46
À : Brian Kardell, public-nextweb@w3.org





On 1/14/14, 11:29 AM, "Brian Kardell" <bkardell@gmail.com> wrote:

>I've been thinking a lot lately because of some related threads on other
>lists:  Is it plausible to imagine a clean/reasonably complete decoupling
>of presentation from structure without adding dubious amounts of
>complexity?  I'm asking it here because i
> think it plays in some ways to think about the direction of the platform
>present and future to look at where to aim efforts at explanation and
>extensibility.
>I guess my question is:  intentionally pretty vague because I'm
>interested in hearing where you all think various answers and pieces
>being pondered fit together in this general aim.

I have been thinking quite a lot on this topic. The way you’re posing the
question, I think the answer is no. There is no reasonably complete way to
decouple presentation from structure, because presentation often requires
structure. Items are grouped or wrapped for purely presentational
purposes. A layout has a structure that is separate from its content.

I think your question is different than, “Is there a way to encode all
presentation in CSS?” I think that *might* be possible, but it would
require adding structure to CSS. I’ve looked in to doing just that, and my
opinion at the moment is that adding structure to CSS is (a) really
difficult and (b) hard to justify when HTML is really good at structure.

So I’m inclined towards approaches that find ways of decoupling the
content structure from the presentational structure in HTML.

Thanks,

Alan

Received on Tuesday, 14 January 2014 21:49:29 UTC