CSS Grid – Table layout is back. Be there and be square
developers.google.com
developers.google.com
display: grid;
grid-template-rows: 150px [nav-start]
auto 100px [nav-end];
grid-template-columns: [header-start]
minmax(200px, 3fr) 9fr [header-end];
CSS fans for some reason seem to think that its somehow better to have rendering/presentational properties in an ad-hoc language. Originally, plain markup attributes where designed to accomodate rendering properties, with type checking and all. The naive dichotomy established by putting "semantics" into markup and "presentational" properties into CSS was accidental, and it didn't make sense back then, nor does it now.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.
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.
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.
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.
A tree node structure for mapping content seems like it'd be the most efficient in all the ways I can imagine it.
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.
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.
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.
I've been writing CSS since about 1996; for some reason, I feel like it all started to go downhill, fast, with the background gradient syntax.
I'll take background in CSS over tiled 1px-wide gradient background images any day. The responsibilities being piled to CSS keep increasing, but I believe it is being done in good faith to at improve/formalize what people in the wild are already doing with hacks. Remember DHTML?
But still... some of the syntax we have now, not to mention the sheer breadth of verbiage, is insane. CSS feels like it's been groaning under the weight of all of this guff for quite some time now, and adding new obscure units and funny things in square brackets isn't really going to improve matters.
I had somehow missed that your gripe is with the syntax - I fully agree with you on that! CSS definitely feels kludgey, especially for larger/complex apps or sites. I now think of real CSS as a target that my build system generates as I mostly write in Sass or LESS. I find those superior to vanilla CSS in maintainability and composability.
CSS/HTML is a complicated mess. But anyone who thinks it used to be better needs to take off the rose tint glasses.
I'm still not sure if we're better off yet. . . .
; rule associated to document's element class
(element (section header)
(make paragraph
font-family-name: "Helvetica"
font-weight: 'bold
font-posture: 'oblique
(process-children)
)
)
; rule associated to a particular element uniquely identified with an id:
(id ("ref34")
(make paragraph
font-family-name: "Helvetica"
font-weight: 'bold
font-posture: 'oblique
(process-children)
)
)
[1]: http://dsssl.netfolder.com/DSSSL-markup-Rules.htmBut what the snippet shows is how eg. the DOM is traversed explicitly, as opposed to CSS's multiple implicit measurement and layout passes over the DOM. CSS sure is more compact, but doesn't begin to reveal anything like the above snippet.
You could then have standard functions that did what a lot of the keywords did.
On the other hand, It could get incredibly complicated too...
(Especially scheme is rather rigid in my humble opinion.)
Lisp for just CSS with all else same: lukewarm idea.
Kinda makes me wish I lived in that alternate universe.
I am a fan of building websites, and css is the only way to achieve that. Yeah it sucks, but it's all we got. Grid spec solves a LOT of problems so even if the syntax is ugly, it's existence in the world is beautiful.
I've used a lot of different layout frameworks over the years. Constraint systems are neat but hard to scale. All-code layout definitions are hard to read and reason about. Markup-level layout systems have their issues, but are easier for new programmers to learn and are the most instantly powerful out of the box. Most dewey-eyed replacements for production layout systems that I've encountered quickly founder when they try to cover all the corner cases that a mature framework would need to support. It's shockingly common to just end up with a kind of crappy version of bespoke CSS. Maybe with better syntax. Definitely with fewer features.
Alternately, if you're really complaining about the fact that you define styles in one file and markup in the other...I dunno, seems fine to me. I've seen systems that try to do all of that in one file (you can do it in HTML if you want to). They're not very readable. Splitting the styling from the basic structure is not a "clean" split, but it does simplify things enough to make your files much easier to scan. Sure, it doesn't live up to the old, pure idea about separating content from styling, but...who cares?
CSS design genesis seems to be "ok we have this and that HTML presentation attribute; let's put it in an entirely new item-value format and separate HTML attributes/CSS properties syntactically".
From this arbitrary decision in language design the idea developed that markup attributes are part of the "semantic" content of a document, and not for styling, when, to the contrary, markup attributes were specifically designed for styling and other properties.
As a consequence, CSS has numerous redundancies, asymmetries, and absurdities such as CSS shapes, SVG properties you can style with CSS, the "content:" property, dogmatic and implementation-driven limitations for using presentational attributes on elements, etc.
Layout matters. Layout carries semantics. Right here on HN is an example, where the comment reply chain is indicated with indentation. The meaning of a comment such as "I disagree" varies depending on what it is replying to and therefore where it is in the layout.
Other examples where layout is content: Captions for photos. An online store where each price describes the cost of whatever item it is next to. Sports box scores and other statistical presentations. Interviews in question-and-answer format where the layout indicates who is speaking.
That's why we've gotten our layout engines so mixed up with our content and markup, because layout is content. How would one devise an abstraction for layout for all of these? You would need to express the semantic relationships within the data, like "comment-replied-to" and "photo-with-caption" and so on. That sounds tantamount to a full implication of natural language processing.
<div class=comment>
<span class=user>T-hawk</span>
Right here on HN is an example, where the comment reply chain is indicated with indentation.
<div class=replies>
<div class=comment>
<span class=user>random28345</span>
HTML is a tree of element nodes, the identity of the post being replied to can be determined by
the position of element in the tree
<div class=replies />
</div>
</div>
</div>
---------------------- .replies {
margin-left: 2em;
}In fact, if it did, I would consider the HTML broken.
<div class=comment.level1>
...
</div>
<div class=comment.level2>
...
</div" You would need to express the semantic relationships within the data, like "comment-replied-to" and "photo-with-caption" and so on. That sounds tantamount to a full implication of natural language processing."
No you wouldn't and no it is not. It's dead simple:
<figure>
<img src='image.jpg' alt='missing' />
<figcaption>Caption goes here</figcaption>
</figure>I've done better looking/performing layouts 20 years ago with plain HTML 3.2. CSS is a mess.
- HTML for pure information - Something else (template/view?) for layout and (possibly) forms - CSS for styling in terms of fonts, colors, etc.
This would easily handle layouts, but it would also have some NLS-like capabilities where you could switch from one way of presenting information to another without changing the actual docment.
(We also would have more sites that looked liked late 90s Flash, but then again, we're moving that direction anyway, just with more effort and convoluted design)
Sometimes less is more and constraints are good, there are things that you shouldn't shoehorn.
Know of any examples of that in practice or is this just a joke?
It's very very not ready yet, but I'd appreciate some pointers or PRs.
Is this a trick question? :) On the scale from pages to apps, where one end is someone's static geocities page about their cats and the other end is, let's say, github: Facebook is definitely an app.
And other parts of Facebook, like the chat, are hard to describe as a page.
Here's the GitHub repo: https://github.com/w3c/css-houdini-drafts
Houdini looks like its trying to do just that.
That doesn't sound implausible. In fact, it sounds like a great idea. As long as performance and security don't suffer, more and more browser internals should be opened up to JS developers so that we don't have to wait for all browsers vendors to implement specific features before we get to use them.
This is actually happening. The major vendor libraries are working on API's to give JS library authors the ability to hook into the browser layout process and define their own layout mechanisms
This is also a good moment to remind people that you don't need Bootstrap and the like as much as you used to. Grids were 90% or the reason people started using these frameworks, and CSS (already with flexbox I'd argue, but definitely with grids) has caught up and is now easier to use and more flexible than any framework was.
It's also time to reconsider the atrocity that is class="col_xs_12". I've never undestood why people would lynch anyone using style="..." but happily littered their code with those grid classes. With the invention of sass at the latest, actual semantic class names should have once again become the only acceptable best practice. With html5, there's also a range of semantic tags[0], and using them improves both code readability, as well as allowing all sorts of new ideas in clients (not just browsers, but also text-to-speech and other accessabiity tools, or spiders, or brosers on new device classes)
o: <article> <aside> <details> <figcaption> <figure> <footer> <header> <main> <mark> <nav> <section> <summary> <time>
only if you don't have enterprise customers. Those will continue to run IE11 for the foreseeable future as IE11 will remain supported in Windows 10 until 2025.
While Microsoft is pushing Edge as an IE replacement, Edge is still lacking features and looks too different from IE for companies to feel comfortable pushing it to their users without retraining them.
We're still supporting IE9... It was a glorious day when we could finally give up on IE8.
I chuckle when Google announces that Chrome will support this feature as the next big thing, while it was clear years ago that this approach is much better than flexbox. But, I'm glad it finally lands in all browsers.
You lucky guys, we still have to support older versions for some specific customers.
But even better was Safari for Windows, on a very specific case around three years ago.
It only runs under IE7.
How I hate it.
I once sent feedback citing security as a moral hazard that someone would get fired over, as the reason IE8 needed to be ditched.
Chrome showed up a few months later, I'm guessing once they'd tested group policies and install scripts (which I think google makes very easy these days). No idea if it was because of me but it was certainly welcome
Luckily, Intl.DateTimeFormat [0] seems to finally allow a reasonable degree of i18n in the browser. If you can live with the limited Safari availability, of course.
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
That'd quickly get awkward. I live in Norway where the default format is DD/MM as opposed to MM/DD used in the US. This works fine for us in general, we know to expect the first one when we read something in Norwegian and the second one when we read something in English. If a computer formatted a date based on a default preference and considering that most websites probably don't specify the lang attribute, I think it'd get messy quickly. Also, different date formats will lead to different sentence structures making sense. For example you might say "ever since 9/11 something something" but you wouldn't naturally write "ever since 11. September 2001 something something" (you'd write "ever since the 11th of September 2001 something something") and likewise you also wouldn't naturally write "ever since 2001-09-11T08:46:40-0400 something something".
On more serious note, such functionality is meant for formatting freestanding dates/times (eg. contents of table cell labeled "last modified") not dates in flowing text.
What you suggest would make that difficult if not impossible. Already it is unnecessarily hard, as JS Date object automatically uses local tz and cannot be coerced otherwise.
This means that you can start implementing it today for modern browsers, and then remove the old one once you are ready to ditch old browsers.
My caveat is that currently @supports is far more heavily supported than grid layout which is not fully available in any current browser. As usual, only IE is the major holdout for @supports and most likely we'll be doing special things for IE until it totally dies out anyway.
If you are speaking of JS framework dumping code into the style attribute on the fly then there's a smaller point for the resistance to that. There are features of CSS that are not available through the style attribute. Plus, it's just plain inefficient.
If it ain't broke, right?
https://dxr.mozilla.org/mozilla-central/source/accessible/ht...
https://cs.chromium.org/chromium/src/third_party/WebKit/Sour...
Even without the accessibility in mind, go to http://csszengarden.com/ and try to replicate that with tables. Barely ten years have passed and the idea that not everything on the web is an app and sometimes it is nice to have ability to change the presentation without even touching the markup.
Flexibility is what allowed webpages to be "responsive" before media-queries even existed, and semantics is what allows accessibility, search engines, and other html parsing tools ("readability" in Firefox and Safari, ...) to function better.
The only advantage it has is that it's old and predictable. That's why it's still used to format emails for instance, it's reliable and works on most supports.
As far as I am aware no spider is looking at the DIV and gathering semantic information from it. Sure, it may look at the TABLE and initially assume it has tabular data in it, but a tiny bit of logic fixes that.
DIVs are not actively anti-semantic. They are just a-semantic. So they're not particularly right, they're just not actively wrong.
Or blind people using a screenreader?
DIVs aren't entirely semantic, but table is semantically wrong for how it's being used. It'd be like if I asked you to "get me the pencil off that thingie" and pointed at a chair with a pencil on it. As opposed to "get me the pencil off that table" while pointing at the same chair with a pencil on it.
That said, CSS layout should have been based on tables/grids from the get go, ie. specify a set of blocks as rows and cells, with colspan and rowspan. It took way too long to get to this point.
ungrid.css [0]
@media (min-width: 30em) {
.row { width: 100%; display: table; table- layout: fixed; }
.col { display: table-cell; }
}
[0] http://chrisnager.github.io/ungrid/I changed it to a real TABLE, since that's far more accessible -- most users can cut and paste into their spreadsheet, and a screen reader might give options to avoid reading out all the data.
Another time, a web developer changed all my <i>Homo sapiens</i> to <em>Homo sapiens</em>.
<span lang="la">
"The i element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose in a manner indicating a different quality of text, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, transliteration, a thought, or a ship name in Western texts."
https://www.w3.org/TR/html5/text-level-semantics.html#the-i-...
https://www.w3.org/TR/html5/text-level-semantics.html#the-i-...
For example, further down the page:
"Authors are encouraged to consider whether other elements might be more applicable than the i element, for instance the em element for marking up stress emphasis, or the dfn element to mark up the defining instance of a term."
As an element it used to be the way to italicize text, to emphasize that text, before CSS. These days it has had a semantic reason for its existence applied which is a slight variation of its original purpose under the HTML4 spec.
<table>
<tr>
<td>
<table>
<tr>
<td>
<table>
<tr>
<td>
That's the problem.This argument was over a decade ago and it's because it's a nightmare to work in tag soup.
I still have to deal with tables for layout on mail templates, bloody Outlook, and that extra 2 layers of tag nesting you have to do on every level quickly turns the code into an incomprehensible mess, even with careful indentation.
And if you're not very careful with indentation it turns into an utter nightmare.
<div class="container">
<div class="maincontent">
<div class="col-md-4">
<div class="row">
<div class="col-md-8">
<div class="row">
<div class="header">
<div class="text-center">
<div class="brand-text">Both are fixed in modern html5 which moves (back) towards simple, semantic, document layout (html-body-article-heading-etc).
With flex-box layout it's also quite easy to have the article/main content come first (possibly preceded by a header) - followed by sidebars and footer -- all as their own "top-level" boxes/containers.
In a classic table layout, there's an extra top level element in addition to "body" - the surrounding table.
And finally table layout is generally verbose and messy for other types of content than tabular data.
Honestly, for what I'm doing (a pretty complex web app with an almost desktop-style GUI with a bunch of buttons, text inputs and checkboxes everywhere) a Bootstrap-style div layout gets at least as verbose and messy as a table layout would. I especially hate having to always do HTML comments with class/id names after every </div> so I know what closes what when I'm near the bottom of the file. At least with tables you get </td></tr></table> instead of </div></div></div>.
But of course a div layout is at least partially semantic and mobile/small screen friendly.
In a classic table layout, there's an extra top level element in addition to "body" - the surrounding table.
In practice, any bog-standard div layout today has a <div class="container"> at top level which contains nothing but other divs and sets size and positioning for the whole page. This is roughly equal to a <table>, no?
> of course a div layout is at least partially semantic
That's contestable, <div> nowadays is absolutely unpredictable, <table>s are more semantic
Sometimes i wish HTML was like python hehe
Sometimes it's a redundant stand-in for "body > .content" or similar (eg: divs dropped directly in body) - and is prevalent because developers don't understand and care about css selectors (or there's that one person on the team that doesn't -- don't get me wrong -- I realize the real world is full of real co-workers, and making a change isn't always easy).
And partially it can be an artifact of abusing floats for "grid layout". Most typically though, the "container div" just ends up being a completely redundant extra "body" element.
Right. There's different contexts between an application an a (hyper)text document.
What's good semantic markup for one, will generally be bad for the other.
It's admirable (and desirable) to strive for adaptive layout and accessibility in applications - but they need a different type of framework than documents made for browsers. The browsers straddle this divide rather uncomfortably - being in part hypertext document browsers, and in part virtual machines for running general applications.
Approaches like web components[1] might help us move toward a standardised reality for "applications that happen to run in the browser", while css and html are still (more and more anachronistically) (hypertext) document markup and layout tools.
If you want to make a Web page/site (like alistapart.com) that's great. Swim with the current and draw inspiration from stuff like css zen garden[2]. With flex box, you can burn[4] most of the old complicated grid layout stuff, and comparatively easily make great sites.
That doesn't really help if you're a "front-end developer" making "apps" though. Even the few that make an effort to color within the lines are still fighting the browsers and the standard, trying to fit a code-on-demand app into a REST shoe[3].
[1] https://www.webcomponents.org/
[2] http://www.mezzoblue.com/zengarden/alldesigns/
[3] https://news.ycombinator.com/item?id=13500635 (I've said it before - the true tragedy isn't that too few read Fielding's thesis and never understood REST - It's that so many ignore that he covered a lot of other architectures that are more suitable for many applications than REST is)
[4] https://philipwalton.github.io/solved-by-flexbox/demos/grids...
<div class="container"> is one of my least favorite things to see in HTML, in particular. No shit it's a container; all HTML tags are containers. HTML5 introduced all these wonderful semantic elements precisely so that we don't have to pollute HyperText documents with thousands of divs.
Also, that "text-center" class drives me to drink :)
It's a standard component of Bootstrap ;)
<div class="tree">
<ul>
<li>
<a href="#">Parent</a>
<ul>
<li>
<a href="#">Child</a>
<ul>
<li>
<a href="#">Grand Child</a>
</li>
</ul>
</li>
<li>
<a href="#">Child</a>
<ul>
<li><a href="#">Grand Child</a></li>
<li>
<a href="#">Grand Child</a>
<ul>
<li>
<a href="#">Great Grand Child</a>
</li>
<li>
<a href="#">Great Grand Child</a>
</li>
<li>
<a href="#">Great Grand Child</a>
</li>
</ul>
</li>
<li><a href="#">Grand Child</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
Lifted from here: https://codepen.io/chuongdang/pen/lcnsCI googled for a solution that I could add to and maintain myself and this was what The Internet threw up as the best solution, but it is far from good.
<ul>
<li>
<a href="#">Parent</a>
<ul></ul>
</li>
</ul>Side note: the top-level div isn't really necessary; you can just apply the `tree` class directly to the `ul` with a small tweak or two to the CSS.
To illustrate how HTML so ill suited to this structure, I had another look at the problem and found Treant, because yes, the easiest to do this on the Web and maintain it is to write an entire API.
(But then you'll hit a wall as you try to deal with the containers and subcontainers.)
Web apps aside [sigh], if one was to disable CSS (and thus all the blocks making it look pretty), the page should still make sense. An H1 as the main header, copy in paragraphs, headers dividing up the content, blockquotes, navigation in lists - and tabular data in tables (etc, etc).
It doesn't always work like that in practice, but that's the aim.
And webpages are a document presentation format. If jamming applications into documents made the web an application platform, than jamming grid layouts into tables made them a grid widget.
Calling a SPA a "page" is a larger and more ridiculous lie than calling the table tag a grid layout widget. Anyone still committed to the table tag lie should move all their apps out of the browser today.
Web developers can work around the table tag, but not the fact they're jamming apps into documents. So one of these lies is taken more seriously than the other.
Accompanied by https://developers.google.com/web/updates/images/2017/01/css...
I'm pretty familiar with Flex but I simply don't understand and the diagram doesn't help. What does 'rhythm' mean in terms of layout?
Taking a guess (which I shouldn't be), I can make https://developers.google.com/web/updates/images/2017/01/css... with flex, but I'd have header and rest-of-page as columns, then have rest-of-page as a row with nav and content, then content as a column with content and footer. I think the article is saying:
> CSS grid means I can do it all at once rather than continually having to make rows and columns.
But it doesn't actually say that anywhere (and again I'm guessing).
Anywho, google helps a bit, [1]. So, yes, you're absolutely right. it's just quite a bit more widespread than typography
[1] https://www.google.com/search?q=rhythm+in+painting&espv=2&bi...
it shows that you can not use flexbox to force the both upper blocks being the same height.
Number of unhappy customers: 0
I'm curious to hear from screen reader users. I recall that the gap between "what web developers think screen readers do" and "what screen readers do" has always been sizable.
<table role="presentation">
Although the screen readers seem to do a decent job of doing this automatically.
In the few times I actually bother with frontend "design", my goal is usually for my actual HTML to contain as few hints about how said HTML should be displayed as possible, and to let CSS handle the display specifics. This usually means that I don't touch `div` and I don't touch `class` unless absolutely necessary. CSS provides more than enough selectors for "absolutely necessary" to be false in the vast majority of cases.
Of course, this ain't for everyone. Some people stick with tables. Some people use div/class for everything. Some people just treat Javascript like the new Postscript and generate pages on the fly. You do you. However, these tend to have their share of downsides, among them being a tendency to deviate strongly from the semantics of HyperText documents.
Tables ought to be responsive anyway, though, even if that just means "add a horizontal scrollbar if the screen is below a certain size". I'm pretty sure that's already possible through CSS, but it involves overriding a lot of the work the browser does for you, and unless the data encapsulated by that table is indeed meant to be tabular, you're probably better off with divs (or better yet, with more specific HTML elements).
B. Maybe if you cared, you'd have 30,300 unique visitors, or more. I don't know, I don't know how bad your site's code is.
And yes, I've been in this space for years, and this is one of the better example why I feel most of the webdev world is cargo-cult advice that's internally inconsistent if you look at it carefully.
Anyone who really thinks about how CSS can be used is also going to be against div-itis but it's still less-bad than tables for layout. They're also going to be against excessive use of classes and class names that connote style (class="red") rather than purpose (class="alert").
It’s not intended to do anything more or less.
No, it's not, as I thought I made plainly clear in my comment. HTML5 introduced a smorgasbord of new tags to avoid that.
You're right that a lot of modern web development fashion is silly, but there are alternatives besides just sticking to tables for everything.
EDIT: I guess I'm mostly talking about class, HTML5 semantic elements takes over much of the utility of divs in this usecase.
This often does indeed result in a bowl of spaghetti, but said bowl is in CSS rather than HTML. Things like SASS/SCSS help tremendously.
Hope nobody will have to modify your stylesheets.
From hard-to-find bugs through SEO-penalty to code-maintainance [1].
I lived the time when there was no CSS at all. Back then we used tables for everything. I'm happy those times are over.
1: http://stackoverflow.com/questions/83073/why-not-use-tables-...
For instance, arguments about ease of change (single place to modify) are irrelevant, because in both cases the single place to modify is the code that renders the layout.
Also, personally I'm not buying the whole separation of layout from content thing. It's an implicitly understood fact people seem reluctant to admit out loud: form is a part of content too! These are not orthogonal things.
Using CSS surely can improve the screen reader experience by the markup not being actual tables.
Replace "nested tables" with "nested divs", and this is exactly how web development today still looks, at least if your company employs a designer. Slicing is still a thing.
Sliced images were an ugly hack for the shortcomings of early CSS (or no CSS if you go back further still).
There's been no excuse for a very long time now.
I want to add a column to a table via ajax, how do I do it? I can't cleanly, I have to modify each tr.
Of course this is anecdotal, but I wonder wether it'd be just easier for browsers to just improve table performance.
Same in politics, war, fashion, tech, research, literature, art, music.
Just keep those 'skinny jeans' in the back of the closet for New Years Eve 2045 ...
content-src: url("http://example.org")Fortunately, I've found that it's quite easy to get to grips with - especially if you have been around long enough to have sliced designs into table layouts!
Now for a rather shameless plug for my own article on the subject (I hope with a closer to real world example):
http://maketea.co.uk/2016/09/28/css-grid-layout-is-a-step-ch...
Edge had better get support this year or I'll consider placing a warning on my website to all Edge users that the layout won't work. I'm over supporting lagging browsers.
But at least we seem to be moving forward from the abuse of [ed:float]-layouts for grid-systems...
[1] https://blogs.igalia.com/mrego/2016/02/12/subgrids-thinking-...
However `display: contents` may help plaster over the gap.
EDIT, reference: http://gridbyexample.com/video/subgrid-display-contents/
Everything is either a column or a row, so in the example layout in the link, you'd need two container divs. Whereas the grid example can be done without any.
Why does an HTML <Grid>-element not exist?
The nice thing about CSS is that you can ignore it in "article view" or mobile. You can't ignore HTML in the same way. Don't you see the value in splitting semantic and styling components of a page?
With flexbox I can do that implicitly without Media queries
I totally feel you, and that is what Houdini’s Custom Layout is going to be about: https://github.com/w3c/css-houdini-drafts/blob/2b730220b2f3c...
I want to write a blog post about constraing based layouts on the web specifically, but the TL;DR on why we don’t have it already:
Standardization is hard. It’s especially hard to reach consensus when:
* the runtime for a layout algorithm is hard to estimate
* it can _fail_ (which is unprecedented in CSS)
* a new syntax for constrains would have to be defined.
The primary force you were always fighting against was inconsistency between browsers. You might get everything perfect in IE, then load it in Netscape and there's huge gaps between your awesome solid colored navigation side blocks. Then making it adjust to the size of the browser was another struggle. After a while I learned to just make everything fixed size. Then content inside continues to nest you have to keep subdividing, and things would start to get out of whack. You adjust one block here, and the side suddenly has these weird gaps. A large part of it was almost certainly the fact that I was about 13 or 14 years old at the time, and I learned only by looking at example code... but It was really difficult.
flexbox doesn't really seem to suffer from the problems that made table layout really suck. I use it mostly indirectly by using the library Bulma, but it's really wonderful.
None of the things you're complaining about are table's fault, though. In the 90s browser vendors didn't target cross-functionality nearly as much as they do now. They could have easily made tables work even better with a modicum of intent instead of plunging us into 2 decades (!!!) of unintelligible nested div hacks that still after all that time weren't up to the task until some arbitrary number of years from today when this feature is actually widespread enough to deploy.
I don't suppose there is any momentum for starting over with something not based on a simple word-processing model, but with a real UI foundation.
Also I find js2css works well to keep component style in place with MVC web components.
(This comment is a response to the multiple inevitable discussions on the merits of HTML/CSS and what is bad or good and how it all should be different, great stuff, thanks for it)
And display: table, which uses CSS to make things look the same, without implying anything about the content, wasn't supported by Microsoft, back when they they were a) the only browser that mattered, and b) trying to hold back the web to protect their monopolies, so people worked around their damage by using the tools that happened to already be available in IE (see also the invention of AJAX)
Once Microsoft caught up, people who understand CSS started using display: table whenever it helped. People who didn't kept complaining that you couldn't just use <table>.
I'm not claiming it's perfect, but it's like government data being released as a CSV vs a PDF with a scan of paper document. Structured data is better for lots of reasons, even if it's only minimally structured.
Every time I hit the wrong link because the browser engine finally figured out it should move things around one more time just that millisecond, my soul gets blackened by the wish to strangle someone.
For Chrome, that means no sooner than 03/14/17. That version, Chrome 57, will also come with automatic background tab throttling[2].
I will stick to flexbox for a while.
In my opinion CSS's worst sin is that it does not include basic experience from other programming languages: variables and name scoping. It's a minefield of namespace collisions and superfluous repetitions.
Or they say from the highest and mightiest and ivoryest pedestal "separation of semantics and display, thus spaketh the lord" pretending, of course, that modern websites look and behave just like documents when that's demonstrably false, and that tables are therefore irretrievably bad.
And instead you now have, 20 years later (TWENTY! YEARS!) something that only now works as well for layout.
Adding "not-data" and navigation directives to tables to aid screen readers and separate semantics would not have taken 20 years.
And now you'll have to wait another 5 years before this new, "just as good as tables!" feature is sufficiently widespread to actually deploy it without a polyfill shim.
But please tell me more about what I do or don't know.
To compare things: Knuth's TeX has very few basic primitives: boxes, lists, and glue. And it produces very sophisticated layouts. CSS has a wagon of stuff and still cannot produce very basic things. I sometimes remember the old Ventura Publisher software (in 1990 I worked with version 3 of it). It was somewhat similar to the current HTML+CSS: you could have the same source text, but separate style files that would render it very differently for different purposes. 27 years ago.