News for hackers. Stuff that matters.
Re:CSS Grid – Table layout is back. Be there and be square by tannhaeuser on Tuesday January 31, 2017 @09:11AM (#13530628)
These things, while beneficial, don't owe their existence to CSS. Instead, introducing eg. CSS shapes or `content: ` (as two extreme examples) was the way of least resistance/guerilla tactics, as opposed to putting the functionality into SVG proper, or aligning the layout box model better with the DOM model, resp. Now what we're left with is a way overcomplicated mess for generations to clean up. There's a reason Mozilla spent the better part of the decade to come up with a new web renderer.

Don't get me wrong. I praise CSS for it has given designers ways to come up with new UI idioms (something I'm personally fascinated with). But I will say this has happened in spite of, rather than because of, CSS's qualities. Designers other than outright CSS nerds are struggling with CSS, and CSS is lacking badly from a basic maintainability perspective IMHO. CSS as a language puts an unnecessarily high cognitive burden on casual web developers by lacking a construct to capture the "intent" of a couple coordinated CSS rules; as a result, unless you're doing CSS every day, you're easily lost in your (or someone else's) CSS.

This isn't helped by seemingly arbitrary decisions as to what goes into CSS vs. HTML. For example, responsive images eg. the `picture` element became an HTML element, but arguably should have been subject to CSS media queries instead.

Which is kindof my initial point: that the HTML/CSS dichotomy is accidental and pointless from a language theory PoV.

Re:CSS Grid – Table layout is back. Be there and be square by tinco on Tuesday January 31, 2017 @09:41AM (#13530880)
I don't get what your point is with mentioning CSS shapes and `content`.

What I am talking about is CSS Zen Garden and the movement around it of frontend web developers professionalizing, rejecting table layouts and non-standard browser features.

This was enabled by CSS being barely powerful enough, and people creative enough to make it work. Eventually the movement won, non-IE browsers won market share and the way was paved for a more healthy evolutionary path of the web which has yielded these new features.

You look at CSS from a perspective that it's hard, as if there exists a solution somewhere that is easier. Before CSS there were simply the less powerful HTML features, the 'easier' but less semantic and non-adaptive tools like Flash or SVG, and the always present and expertise requiring method of simply imperatively coding the styling in WinForms or whatever.

CSS was absolutely crucial.

Re:CSS Grid – Table layout is back. Be there and be square by pcwalton on Tuesday January 31, 2017 @12:36PM (#13532942)
> There's a reason Mozilla spent the better part of the decade to come up with a new web renderer.

That had nothing to do with the fact that HTML and CSS are independent.

Tables are way way more complicated than anything in CSS. In fact, tables are unspecified.

This [1] is a work in progress draft and incomplete. You'll be forgiven if your eyes glaze over while reading it.

[1]: https://dbaron.org/css/intrinsic/

Re:CSS Grid – Table layout is back. Be there and be square by tannhaeuser on Tuesday January 31, 2017 @01:15PM (#13533438)
This is not a tables-vs-CSS thing. Hey, I'm looking forward to servo and applaud Mozilla devs for it; but the reason they found it worthwile to invent an entire new programming language for implementing it certainly is telling about CSS's insane complexity.
Re:CSS Grid – Table layout is back. Be there and be square by pcwalton on Tuesday January 31, 2017 @01:52PM (#13533872)
GPU vendors invented an entirely new programming language for drawing triangles. Creating a new programming language to a solve a task doesn't mean that task is overly complex.

CSS has its problems (I'm the first to admit that), but on balance I think it's the best layout language that has been devised for documents.

Re:CSS Grid – Table layout is back. Be there and be square by diamondlovesyou on Tuesday January 31, 2017 @11:30AM (#13532019)
I agree. Most of the HTML I write is to create structure for CSS to use. For example, a `div` is a container, but we put it on the content side.

What would have been better would be a flat map identifier -> binary (or string or whatever, your choice) as the content, and then "CSS" (quotes because it wouldn't be the CSS we know now) would declare the layout/look and would read the content map for insertion into placeholders declared in the "CSS". I've omitted programmable considerations cause this is a HN comment and not intended to be formal proposal. Not surprisingly, the web has kinda already shifted towards this, through the use of JSON APIs in JS.

Re:CSS Grid – Table layout is back. Be there and be square by debaserab2 on Tuesday January 31, 2017 @01:24PM (#13533513)
The content map is the dom, no? I can't see what you described ending up any less complex than what we have today.
Re:CSS Grid – Table layout is back. Be there and be square by jdmichal on Tuesday January 31, 2017 @03:15PM (#13534774)
The DOM is more than the proposed content map, because it also creates structure. I think the proposed idea is to basically create a structure without any content, then apply the content into that structure.

The current split is CSS is presentation while HTML is content + structure. Unless I'm misunderstanding, this proposal would separate content and structure. I'm not sure where presentation would go; you could certainly make a case for it being grouped with either.

There's also plenty of questions around what's content and what's structure and what's presentation. For instance, a section heading is potentially all three. I personally would probably go for grouping presentation with the content, and call structure "layout" to disambiguate it. A section heading is maybe structure, but it's definitely not layout.

Re:CSS Grid – Table layout is back. Be there and be square by debaserab2 on Tuesday January 31, 2017 @06:22PM (#13536424)
I'd be curious if there are any existing example implementations that you think demonstrate this - I'm having a hard time wrapping my head around how flattening the structure would make things better.

A tree node structure for mapping content seems like it'd be the most efficient in all the ways I can imagine it.

Re:CSS Grid – Table layout is back. Be there and be square by jdmichal on Tuesday January 31, 2017 @06:44PM (#13536585)
I suppose I'm thinking of something like ASP.NET `ContentPlaceHolder`, where you create some layout and identify holes into which the content will be placed. Except that, unlike ASP.NET and HTML, only layout elements would be permitted? This would likely be an entirely new language -- thinking of it like HTML except without text doesn't really work. Think of it more like defining panes on the screen, and the content (like HTML) is injected into those defined panes.

How the panes are laid out could be accomplished through any number of methods. Absolute, flow, flex, grid, constraint solving... Or even parent panes using different methods for their sub-panes!

The point isn't to flatten the layout. The layout can be as complex as desired. The point is to remove content from the layout; a named mapping is just an easy way to associate content to layout panes for injection.

Re:CSS Grid – Table layout is back. Be there and be square by kalleboo on Wednesday February 01, 2017 @08:28AM (#13540526)
At one point XSLT was created to convert XML documents into presentation markup. Browsers supported it and everything. It never caught on though.
Re:CSS Grid – Table layout is back. Be there and be square by nstr10 on Wednesday February 01, 2017 @06:06PM (#13546349)
I feel like that's because XSLT introduced so much complexity that mere humans found it impossible to work with. I've searched in vain for a decent XSLT editor to help me; the ones I've tried have themselves been incredibly complex. The idea was good, but the implementation is the stuff of nightmares.