Live data from Hacker News

CSS is unnecessary given a layout language

pchiusano.github.io

81–90 of 183 posts

Re: CSS is unnecessary given a layout language

#81

Earlier quoted context omitted.

It's not that it's difficult, really, but the tools are incredibly underpowered. For example: * How do you vertically center an arbitrary element inside another where you don't know the height of any of them? Answer: The only reliable way is via "display: table-cell". It has several annoying limitations. * How do you ensure that several horizontally adjacent boxes fill the width of the container and are all of equal…

1. Flexbox, through the align-items property. 2. Flexbox, setting flex: 1; to the boxes. Can be done vertically or horizontally. 3. Flexbox, setting flex: 1; to boxes. Setting a min-width to a flex-item takes precedence so it will be honored. 4. You got me. I remember hearing talk about an aspect-ratio property. I'm not sure if the object-fit/object-position properties get the job done. The hacks will have to continu…

Right, but flexbox is fairly new. CSS sucked because it made the most common things people want to do really really difficult. Most people gave up and went back to tables because tables give you an understandable grid layout with trivial effort. CSS is just now starting to make the most common layouts easier.

Re: CSS is unnecessary given a layout language

#82
Most "problems" with CSS (with the exception of vertical centering and a few others) are caused by the fact that people can't be bothered to learn CSS.

It's funny: if a programmer is told to write CSS but doesn't know how, he'll copy-and-paste from Stack Overflow, get a shit result, and say that CSS sucks. If a programmer is told to write Elm but doesn't know how, he'll learn the language, write some decent Elm, and be happy. Now, who do you think will have the better time - the person that actually learned his tools or the person that copy-pasted CSS from Stack Overflow?

Even if you assume that CSS is as horrible as the author would have you believe, the 'solution' of Elm is preposterous. As another commenter [0] said: it outputs a crazy amount of divs, all the styles are inline, you lose the CSS ecosystem, and you lose performance. Even the demos of Elm for layout are completely broken.

[0] http://pchiusano.github.io/2014-07-02/css-is-unnecessary.htm...

Re: CSS is unnecessary given a layout language

#83

Most "problems" with CSS (with the exception of vertical centering and a few others) are caused by the fact that people can't be bothered to learn CSS. It's funny: if a programmer is told to write CSS but doesn't know how, he'll copy-and-paste from Stack Overflow, get a shit result, and say that CSS sucks. If a programmer is told to write Elm but doesn't know how, he'll learn the language, write some decent Elm, and…

I've learnt many technologies over the years and I will no doubt learn many more. Your statements above don't consider the important question - the relative complexity of CSS compared to other aspects of web development.

"You can't be bothered to learn your tools" isn't terribly helpful when you've just given someone a hammerwrenchbathplug.

Re: CSS is unnecessary given a layout language

#84

Most "problems" with CSS (with the exception of vertical centering and a few others) are caused by the fact that people can't be bothered to learn CSS. It's funny: if a programmer is told to write CSS but doesn't know how, he'll copy-and-paste from Stack Overflow, get a shit result, and say that CSS sucks. If a programmer is told to write Elm but doesn't know how, he'll learn the language, write some decent Elm, and…

My instinct was to disagree with you because I've been doing CSS for so many years and still find it frustrating. Then I realized in all of those years, you were right, I never did take the time to read a book on it.

I don't want to understand CSS deeply, because the fact is I hate using it. I find it overly difficult to get right. I find it illogical at times. I used to find figuring out the differences between browsers in regards to it a nightmare (not so much anymore). But, you're right, perhaps if I read a book, it would all be much easier. The 10 hour investment in really understanding a good book, would make the many years of messing with it and hoping it works seem wasted.

The only way I've kept my sanity is through using frameworks like Bootstrap. I feel like I rather delegate the responsibility of learning what I see as a mess to the designers of a CSS framework. I figure, if I can understand so many complex things well, and using CSS is still a challenge, it must be CSS, not me. But, maybe it is me. On the other hand I feel in my gut, after many years of working with Interface Builder/Visual Studio and other IDE's GUI layout tools, there must be a better way for non-designers (and designers for that matter) to do this.

Re: CSS is unnecessary given a layout language

#85

Earlier quoted context omitted.

Browsers are struggling to support 1 toolset as-is. Imagine the message of multiple tool sets.

Browsers are only struggling because of how complex the toolset is and how poorly defined the expected results are. There are plenty of counter-examples with simple standards and multiple implementations of a high degree of quality and interoperability.

plenty? Let's hear one.

Re: CSS is unnecessary given a layout language

#86
post #69

Earlier quoted context omitted.

> Firstly, I find it hilarious that when I opened this blog post dissing CSS the author's 'responsive' design was completely and utterly fucked. That kind of proves his point, though. If the foundational layout language for the web requires more than basic effort to create a responsive design, something with it is fundamentally rotten to the core.

> If the foundational layout language for the web requires more than basic effort to create a responsive design, something with it is fundamentally rotten to the core. CSS is a language. Like Haskell, C++, or Ruby, if you only put "basic effort" into learning it when you try to write some it will be absolute shit.

> CSS is a language. Like Haskell, C++, or Ruby, if you only put "basic effort" into learning it when you try to write some it will be absolute shit.

CSS is not a general purpose programming language. A domain specific language is a failure if the most basic features of the domain cannot expressed with minimum complexity.

THERE'S NO WAY TO CENTER THINGS VERTICALLY WITHOUT FALLING BACK ON HACKS, FOR GOD'S SAKE!

Re: CSS is unnecessary given a layout language

#87

CSS is broken. I've just been watching a colleague learning HTML/CSS for the first time. HTML was easy and she has a very good handle on that, producing some nice HTML5 markup by hand very quickly. CSS has been a nightmare - mostly not because of selectors or values (that comes later), but because of basic layout issues caused by the nasty hacky layout model of CSS - in particular the concepts of floats, block and in…

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 tables. Not only that, the resulting table-based design HTML was an intuitive read.

The reason was as you say: Grids are key.

How many people would now honestly say that we are better off for CSS-layout vs. tables? But, it's amazing how an entire industry lurched in one direction so quickly, based on ideology. The pressure to use the "right" approach was immense. The whole thing had a very "Emperor's New Clothes" feel to it. Everybody seemed to agree that CSS layout was completely awesome, while I beat my head against the wall trying to make it work. Now, we all see that so many were actually suffering in silence.

>the separation of concerns in HTML into content/style/controller is very useful

This is a belief that I question to some extent and I've wondered whether it's a core assumption that sounds great and thus goes unchallenged, but fails to make the cut in the practical world. In particular, how much do we really need to separate content from layout? Styling is one thing, but layout tends to be intrinsically tied to the content. You can change the appearance of content without modifying its meaning, but changing its organization or layout can render it absolute nonsense. Thus, if CSS were all about colors, fonts, etc., it would actually be a somewhat reasonable approach to separating reasonably separable concerns.

But, as most now agree, it's CSS's horrible attempt at managing layout that makes it so painfully bad. And, I really wonder if the core problem is just that there's no real benefit to trying to separate layout (vs simply style) from content in the first place. What we're really saying in attempting to do so is that we want to be able to create a document wherein we have a bunch of unstructured content that we want to insert in an essentially random fashion, then create a second document that rearranges the content.

It's an unnecessary abstraction that seldom provides an ROI. How often do we later want the content to stay exactly the same, but simply want to change where it appears on the page? And, if we do, is it really easier to change the layout in an external document (CSS or otherwise) than it is to modify the document?

I have yet to hear a proposal that makes more sense than the old-table based design. The purists said that tables are strictly for presenting tabular data. Fine. So, let's create a new tag called "grid" for layout and give it the same layout flexibility as the tables of old.

Re: CSS is unnecessary given a layout language

#88
post #72

Earlier quoted context omitted.

1. Someone _has_ come up with the One True Layout System. It's just that most people like to pretend TeX doesn't exist or, when they grok the box-and-glue layout model, try to reinvent it from scratch.

Someone yell at me if I'm wrong, but isn't TeX designed for paged content? That means while TeX might work amazingly for paginated content, single page apps, or really any non-paginated content, is very much a screwdriver where a hammer should be used scenario.

TeX is the opposite of a layout language. It's closer to HTML than CSS.

Re: CSS is unnecessary given a layout language

#89
post #86

Earlier quoted context omitted.

> If the foundational layout language for the web requires more than basic effort to create a responsive design, something with it is fundamentally rotten to the core. CSS is a language. Like Haskell, C++, or Ruby, if you only put "basic effort" into learning it when you try to write some it will be absolute shit.

> CSS is a language. Like Haskell, C++, or Ruby, if you only put "basic effort" into learning it when you try to write some it will be absolute shit. CSS is not a general purpose programming language. A domain specific language is a failure if the most basic features of the domain cannot expressed with minimum complexity. THERE'S NO WAY TO CENTER THINGS VERTICALLY WITHOUT FALLING BACK ON HACKS, FOR GOD'S SAKE!

Sure, it's not a general purpose language. As a result, writing decent CSS is easier than, writing, say, decent Haskell. But people have to put some effort into learning it or they'll get crap.

I agree with you entirely re:vertically centering things, but that's one of a very small number of major flaws in CSS.

Re: CSS is unnecessary given a layout language

#90
I'd say we're getting pretty good mileage out of what we've got? CSS dominates layout for a large portion of overall screen time.

Are native app developers crying for CSS? Not exactly.

The browser window itself is a big layout impediment on the desktop. On mobile, hopefully the browser will just get out of the way, and give the app a decent way to install an icon, and some more "permanent" state.

Post reply on HN