Live data from Hacker News

CSS is unnecessary given a layout language

pchiusano.github.io

171–180 of 183 posts

Re: CSS is unnecessary given a layout language

#171

Earlier quoted context omitted.

> I've been writing CSS for years and I still feel like a newbie sometimes, and feel like I'm just tinkering with random attributes until it looks right. This is exactly how I work with CSS too. Not surprisingly, it's my least favorite aspect of web development.

This is how everyone I know works like, myself included.

Just like programming, a lot of time can be spent debugging. Also, just like programming, the more systematic your approach, the less time you will spend debugging.

The solution is to stay DRY by applying OOCSS/SMACSS/BEM concepts using Sass/Less.

Re: CSS is unnecessary given a layout language

#172

Earlier quoted context omitted.

Seems to me that the answer is to provide a real applications development environment. Not to shoehorn ever more crap into browsers. I've called before for splitting Web functionality into several modes. I think it's fairly clearly the way to go, and is actually how development's been headed to a reasonable approximation for the past few years. 1. A reading / discussion oriented platform. The traditional browser, tho…

How are 2-4 not covered by every other applications development platform on desktop or any other platform?

What browser-based apps offer is a uniform platform for applications development. It's a HUGE revolution in applications space, and as much as it's frustrating to me (on both the user and developer/ops side), there's no denying its impact and significance.

Supporting a zero-install or minimal-install path, supporting all platforms from the same runtime, and providing instant updates to all users is tremendous. It's a large part of what's made smaller Web ISVs (SaaS) possible. Systems integration and platform support kill applications design in other contexts.

But those same features are also limitations. I've had multiple horrible app upgrades, apply massive amounts of styling to Web sites and apps, and _still_ run into compatibility issues, as a Linux user. And then there's the security profile.

There are a number of compromises possible, but pulling the "applications runtime environment" out of my "information delivery tool" seems an increasingly positive step.

Not that we haven't had attempts to provide that runtime, e.g., Java and ActiveX.

One problem is that the runtime itself cannot run as the same UID as the user invoking it. It's got to be fully sandboxed and separated, further by origin site or authoring authority. Possibly within its own VM. Trust of Web content is a real problem and one that will only grow.

Re: CSS is unnecessary given a layout language

#173

Earlier quoted context omitted.

Constraints based system is the way to go. And yes, it should be native replacement for CSS- a DOM property called constraints instead of style. Unfortunately, JS has to be used for now. [1] As for parallelism, we still have web workers for the solving of constraints computations. http://gridstylesheets.org [1]

> As for parallelism, we still have web workers for the solving of constraints computations. I am confident that the lack of shared memory, along with the heavyweight nature of web workers, means that any attempt to use web workers to perform parallel layout will be slower than sequential.

You are correct. A native solution with a dedicated thread would be amazing.

Re: CSS is unnecessary given a layout language

#174
post #171

Earlier quoted context omitted.

This is how everyone I know works like, myself included.

Just like programming, a lot of time can be spent debugging. Also, just like programming, the more systematic your approach, the less time you will spend debugging. The solution is to stay DRY by applying OOCSS/SMACSS/BEM concepts using Sass/Less.

It's the properties of CSS, and browser quirks that make CSS a pain. Not the ordering and markdown of files.

Re: CSS is unnecessary given a layout language

#176
post #170

Earlier quoted context omitted.

Indeed CSS is broken. But, if you tried to make that case several years ago during the Great War on Table-based Layout, you'd have been absolutely persecuted. Oh how we wrangled with the utter pain that is CSS layout, only to appease the tableless zealots. I can remember wrestling for hours with simple layouts that just wouldn't cooperate cross-browser. Meanwhile, I could achieve those layouts in mere minutes with ta…

I tend to agree with how using table to do layout got vilified for often very little reason. On the other hand, when dealing with responsive sites, or wanting to switch layouts in javascript for a reason or another, using css is the only sane way. Hopefully, css tables are very usable, and playing with them is nice and smooth most of the time. Being able to cleanly redeine grids of content on the fly is one of the bi…

I am probably an outlier in my views on responsive design, but I'm not really sold on it either. Part of the reason is that, again, I think content is more tied to layout than people acknowledge. Also, I haven't really seen a compelling implementation of responsive design.

Most of the time, I see responsive sites hiding the site nav into a pull down menu and smashing, say, a three column layout into a single column. There are also responsive sites that outright selectively hide some content on some devices.

Hiding content implies that either the content isn't that important in the first place or that a diminished experience will be delivered to a particular device. Neither of these seems desirable.

Likewise, smashing a multi-column layout into a single column is also frequently a suboptimal user experience. In these scenarios, at least one column is usually more akin to nav, which means the user must now scroll past an entire column of nav to get to content or vice-versa. In effect, the layout change has altered the meaning of the content.

So, in general, to really deliver an optimal experience per device (if device specificity is even truly required in the first place), I believe it's worthwhile to consider different sites per device. Responsive design is a compromise that tempts devs into a "reuse" approach but, in truth, neither the required CSS nor the resulting output are optimal. So, the user experience suffers and the code isn't a lot of fun to write or maintain.

In other words, the more you want to thoughtfully vary the layout per device versus, say, just cramming everything into a single column, the more CSS you'll have to write. At some point, the volume and hackiness begs for a separate-site solution. To avoid this, responsive design just sacrifices the user experience instead.

The last part of this is that responsive design feels like a kludge aimed at solving a transient problem that is increasingly being solved by better hardware and interface design at the device/browser level. For instance, bigger and more readable displays on mobile devices, combined with pinching plus auto-zoom and auto-sizing by mobile browsers means that full desktop sites are generally very presentable on mobiles now.

In that regard, responsive design feels like WAP did years ago. Smartphones with full browsers, increased bandwidth, etc. killed the need for WAP in short order. IMO, responsive design will ultimately go the same route and has already to some extent. I, for one, already request the desktop site on all of my devices and much prefer the experience.

Re: CSS is unnecessary given a layout language

#177

Earlier quoted context omitted.

> We finally shove bytecode-level runtimes into a browser and let a thousand flowers bloom asm.js and PNaCl are here today. What more are you expecting?

People to move from HTML+CSS to Canvas/WebGL and some constraint solver for client side rendering, in order to take advantage of those runtimes.

A few websites manage to reimplement decent scrolling today, but I have yet to see scrolling that's better than standard behavior. This sounds like a move to have everyone use their own scrolling engine.

Maybe we are at a point where there are too many novice user to care about interoperability, but I'm a big fan of the fact that my browser understands the content it renders and that I can run plugins to manipulate it. I daily highlight text to search for it, drag non-marked-up url's to the URL bar to open said links, change page layout for easier reading, translate words as my curser point to them, etc, etc. all features that flash pages used to break and a "canvas/webGl" world would appear to break as well.

Re: CSS is unnecessary given a layout language

#178

Earlier quoted context omitted.

Indeed CSS is broken. But, if you tried to make that case several years ago during the Great War on Table-based Layout, you'd have been absolutely persecuted. Oh how we wrangled with the utter pain that is CSS layout, only to appease the tableless zealots. I can remember wrestling for hours with simple layouts that just wouldn't cooperate cross-browser. Meanwhile, I could achieve those layouts in mere minutes with ta…

Styling is one thing, but layout tends to be intrinsically tied to the content. This is an interesting distinction - thanks. As you say there are issues with separating layout and content, because the two can be hard to separate effectively. I think it is worth the effort though, and sometimes pays off (for example reflowing content for a mobile device). An interesting thought though that we should separate style and…

Good points. I think that responsive design is probably one of the biggest use cases for CSS layouts these days, though I don't know that it was a driving force or even a consideration when The Great Tableless War began. In any case, I'm not quite a believer in responsive design either. The short is that, as commonly practiced, responsive design fails to acknowledge the relationship between content and layout. I posted a lengthy comment on this thread with more on that, so I'll spare HN's bandwidth the duplication.

Image slicing was indeed nasty and I don't think it was as much a function of table-based layout as an implementation choice. Some tools were particularly nasty with this, but they were less famously also capable of outputting equally nasty CSS/div based code. So, good handcoding is really required to achieve any semblance of maintainable design, whether CSS or table-based.

But, I think you nailed the history. And, it just happened that table capabilities were remarkably useful for laying out a page. Had this been intentional vs a byproduct of that tag's function, the outcome may have been different. One could literally rename "table" to "grid", "tr" to "row", and "td" to "col" and be most of the way there. Would a separate tag of this ilk that could be additionally styled with CSS have silenced the tableless zealots? We may never know. But, if so, it's amazing to think that all of this upheaval, pain, and lost hours was the result of such simple puritanical ideology.

Such an HTML tag vs. pure CSS construct would have also pointed to the already blurred lines between HTML's suggested role as merely a data container vs. its unavoidable role in presentation. The theory that HTML represents only data still manages to sell itself when we are talking say, paragraph and list elements. This is so, in spite of the fact that, like "real" tables, even those elements are themselves completely loaded with implicit layout information.

We need to embrace the fact that a paragraph tag implies that this element will need to be offset and, yes, the details can be found in the CSS. But, when reading/writing the code, the order and structure are intuitive. We don't randomly spit out a group of paragraphs, then impose the ordering via a stylesheet. Instead, we expect the order to be as it exists in the document. Same with lists and other elements. Likewise, the fact that the structure of the document has implications on its layout even leaks through when using CSS. For instance, assigning a value of absolute to the position attribute of an element, positions it relative to its ancestor in the document structure.

But, it's when "pure" layout is involved that things become murkier. We suddenly want to disavow that the natural layout clues are already there and instead force this unnatural separation into CSS. The problem is that much like with tabular data or a series of paragraphs, all content on a page has a relationship to other content that is best expressed in a natural grid like structure. It's not just visual, but actually semantic. So, it is natural to express this relationship in the markup and leave the styling details to CSS. Perhaps more importantly, it is unnatural to spit a bunch of related content into a document in a completely unstructured fashion, then impose structure in a separate document.

So, let's not repeat the ideological mistakes of the last Great War. Ask your Congressperson to keep the grid element out of CSS (except for styling) and add it to HTML where it belongs! :)

Re: CSS is unnecessary given a layout language

#179

Earlier quoted context omitted.

You seem new to this. Just keep centering variable height content vertically in variable height containers on different browseres until you get what's broken with CSS. You can also try to pick up a newspaper (multicolumn) and try to replicate its layout so it behaves well with dynamic content.

Both of those things are easy. Doing both of those things in IE6 is hard. To me, IE6 is broken, CSS isn't.

Ie6 is ancient history now. Ie9 is the new ie6.

Re: CSS is unnecessary given a layout language

#180

Earlier quoted context omitted.

Both of those things are easy. Doing both of those things in IE6 is hard. To me, IE6 is broken, CSS isn't.

Ie6 is ancient history now. Ie9 is the new ie6.

In a way, yes. IE6 isn't something that I have to support anymore.

However, most clients actually pay an extra to have us support IE7 - 8. On responsive websites. With plenty of customization and fancy graphics.

Post reply on HN