Live data from Hacker News

CSS is unnecessary given a layout language

pchiusano.github.io

151–160 of 183 posts

Re: CSS is unnecessary given a layout language

#151

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…

Flexbox would solve a lot of these, but it's not supported by enough browsers to be usable, afaik. Are people using it in production?

Re #5, I managed to leave out the important part. I mentioned tooltip because I was going to write: ...where the element is placed _above_ another arbitrary element. This is impossible, and raises problems such as escaping "overflow: hidden" and what if the position goes beyond the viewport.

6: In theory, but it is apparently not supported by all browsers.

7: Not the parent, but an arbitrary element. For example, let's say I have an input field. I want to show an autocompletion dropdown box. The box should be at least the width of the input field. It must be absolutely positioned. The parent container of the input field may have "overflow: hidden", too.

(Overflow handling is really a broken concept that screws up a lot of CSS, because there is no way to escape it. Z-index is another awful one.)

Last pet-peeve: Floats depend on their order in the DOM. A float-right element must be placed before any non-float element in order to position itself vertically to be aligned with the parent box.

Re: CSS is unnecessary given a layout language

#152

"It’s true that in using a language like Elm for layout, one loses the ability to cut and paste random CSS found on Stack Overflow in cargo-cult fashion without understanding what it does. I consider this limitation a feature." Wow, elitist much?

It could have been worded better, but if you consider that people will do this copy-paste out of frustration with the inability of CSS to come up with a reliable, easy to use way of doing layout, which Elm solves, then it's not entirely unreasonable.

Re: CSS is unnecessary given a layout language

#153
The problem with the web is more fundamental: it is trying to simultaneously be two different things. One of these things -- document markup and hypertext linking -- it does pretty well. The other -- a GUI framework for remotely accessed applications -- it does horribly.

Re: CSS is unnecessary given a layout language

#154

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…

That. I actually learned CSS in a school. My teachers were real front-end developers. I can honestly say that I never had any problem with CSS and that I never found it to be broken. The only issues that I think of come from trying to fix things for the old IE browsers, which are broken. CSS itself? Mastered it in 3 months if not less. Come on, people. You can't give me both "You are paid less because CSS is easy to…

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.

Re: CSS is unnecessary given a layout language

#155
post #17

I actually like CSS as it is now, and it's getting better ( cough , flexbox). Am I the only one who finds CSS incredibly hard to master, though? 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.

Suppose you want to create the largest possible square div inside the rectangle of another div. Any layout language that can't let me satisfy such a simple and obvious layout constraint is a travesty. CSS will not let you do this, even with flexbox.

Flexbox also doesn't interoperate with grids very well. Also can't lay out elements that are not siblings.

Re: CSS is unnecessary given a layout language

#156
post #51

Graphical layout is one of the most underestimated challenges in computer science. Programmers instinctively look at the problem and thing "oh, this is logical, I'll just whip up some basic principles and layout primitives and I'll have this solved in no time!" No, you won't. Designing a layout framework is really, really hard. Designing one that is simultaneously expressive enough to handle all of the crazy corner c…

Designing one that is simultaneously expressive enough to handle all of the crazy corner cases that pop up on a daily basis AND simple enough to allow "normal people" to actually use and extend it is quite difficult.

Erm, ... No and yes,

OK, take old problem in designing a system, demand that it solve "all of the crazy corner cases" and viola, you have a challenging, even unsolvable problem in computer science. Indeed, such problems are not even problems of computer science, they are problems of software engineering, of human relations and so-on.

Designing a layout system isn't a hard problem but it does involve tradeoff. Like many other system, if you shop around for something that's all things to all people and assign a vast committee to create it, you'll windup with a thing a best ugly and possibly unusable. But there's nothing too specific to designing layout systems here.

Re: CSS is unnecessary given a layout language

#157

Earlier quoted context omitted.

I think you're being downvoted because life isn't just about creating something. Basic accounting is an important tool for any adult living in this world. I would argue the knowledge of managing finances is more important than programming, because it applies to everyone, regardless of your career path. Debt, loans, mortgages, interest, investments, retirement plans, etc. These are important things for everyone to und…

I have run successful companies and been fine without ever knowing basic accounting. We are not talking about what is most important we are talking about what is most useful powerful for someone who today is in school and need to have some skills for the future. Are you seriously telling me that if you had to choose for your kid you would tell them to learn accounting and not programming?

You're missing the point, we're not talking about career paths here, no one is advising anyone to become an accountant over a programmer. We're talking about an introduction to these subjects.

If you had one week to sit down with every person in this world, I think that time would be better spent discussing finances, investments and retirement, instead of an introduction to variables, if/then statements, and loops.

Re: CSS is unnecessary given a layout language

#158
I'd say we still have one language too few.

At the beginning html had content, layout and styling. CSS pretty cleanely excised all the styling from HTML. But it took out large part of layout functionality but lots remained. Best way to follow would be to extract layout stuff from HTML (so it can do what it does best, semantically annotate the content) and from CSS (so it can do what it does best, all the pretty colors, decorations and animations) and put it in new language that can define layout elements and bind styling and content to those elements.

Re: CSS is unnecessary given a layout language

#159

Earlier quoted context omitted.

That. I actually learned CSS in a school. My teachers were real front-end developers. I can honestly say that I never had any problem with CSS and that I never found it to be broken. The only issues that I think of come from trying to fix things for the old IE browsers, which are broken. CSS itself? Mastered it in 3 months if not less. Come on, people. You can't give me both "You are paid less because CSS is easy to…

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.

You can easily do that...

The problem is trying to do that for every browser.

Re: CSS is unnecessary given a layout language

#160

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?

Because no one application framework is already supported by the vast majority of Internet-capable devices, requires no "installing," and supports a standardized and ubiquitous system to link between applications.
Post reply on HN