4

CSS is the worst idea ever.

Ok, maybe it started out as a good idea.

But now it’s just a big pile of diarrhea that nobody knows how (or wants to) clean up.

Comments
  • 0
    Someone help me understand because I'm not familiar with CSS (I mean, I know what it is but not enough to form an opinion).

    Is it like PHP then it got forked it several times and now we have like 15+ PHP variants?
  • 3
    @fruitfcker It’s the presentation layer for the content in the HTML. It was supposed to make styling pages easier while keeping content separated from how the content looks. But the browser wars, and standards wars, severely corrupted it. You can’t just center text or images. You have to write completely non-intuitive styling code to force the browser to do what a reasonable person would expect to be very simple.
  • 5
    We could all go back to tables and <font color = red> tags </font>🤷‍♂️

    CSS "was" suppose to allow for removing styling from the dom and having a single source of truth and reusability, but like all things web based, it was abused and butchered and slapped across someone's face a few times to many before ending in the shit show we have today.
  • 5
    Read up on CSS3. Flexbox basically fixes everything layout-wise, there are some measurements (v_, pr, ch) that are genuinely useful, media queries let you write custom rules for more or less any screen you care to specify…and I haven’t been stung by a browser war issue (other than inputs looking a bit different) for years now. Once I would have agreed with this, but I have to say that I think CSS is basically fixed now.
  • 3
    @MM83 I second this. Flexbox really changed my opinion about CSS. CSS is beauty now.
  • 1
    Also, I would like to summon @kiki here. I have heard they are some kind of lord when it comes to CSS.
  • 3
    Flexbox, Grid and calc() are awesome. The web is no longer just a collection of documents, it consists mainly of apps. As such, HTML+CSS needs to become a UI framework preferably with CSS being solely responsible for layout and looks so that the DOM can be constructed with indexing and accessibility in mind.
  • 4
    @Cyanide I’m not going to explain what a declarative language is to some php boubas that don’t know shit. If someone voluntarily wants to make a clown of themselves, I’m not gonna stop them.
  • 0
    @C0D4 But it's not like they flunked an easy solution. I thought about this quite a bit for my own interface thingy and I can't for the life of me figure out what the relationship between content, layout and style should be. From that perspective CSS is actually quite a good solution for what it is
  • 0
    @12bitfloat I always wondered how and whether a declarative layout engine could be based on describing positions and sizes in relation to one another and then having an equation solver compile the result.
  • 1
    @lbfalvy MacOS actually does it this way IIRC using the Cassowary constraint solver. It solves some things (pun intended) but CSS has way more problems than just that (and adding a inequation solver might just add more incomprehensible weirdness)
  • 2
    Ok so since you suggest that CSS should be cleaned up... I would like to know what would be the first CSS keyword you would like to remove from CSS spec

    Cause, you know, ppl often say "it is crap" but cannot come up with anything better 👌
  • 2
    @hinst To be fair, you can say a meal is aweful without being a chef. That said, I do actually agree. CSS gets a bad name because it is trying to solve a problem that doesn't have a good solution
  • 1
    @12bitfloat I hope it has a good solution, but the problem is inherently hard, good solutions are necessarily complex and operate with a high entry barrier and most complaints against CSS stem from people refusing to learn it.
  • 2
    CSS is actually a good idea, except that many people have never understood even the basic concept, as witnessed by all those "CSS frameworks" that basically re-introduce the 1990s way of polluting the structural markup with presentational shit.

    Centering looks difficult until you answer yourself one critical question: centering within what exactly?

    That's also why vertical centering is more difficult, because that's what it is. This isn't a sheet of paper, this isn't desktop publishing for a flyer. This is the web where the vertical size is potentially infinite, that's why we have scroll bars.
  • 0
    @kiki Fair enough.
  • 1
    @Fast-Nop is the only one except me who knows what the fuck he’s talking about.
  • 0
    @stackodev do you want to know what was really the worst idea ever? you choosing to be a software engineer. Just quit.
  • 1
    @kiki Me having expressed exactly the same sentiment about css: 😐
  • 0
    @Fast-Nop But since the web is now an application platform rather than a document viewer, there's no reason why vertical space should be unlimited. Usually when making a webpage we're very conscious about where the scrollbar is and there are several independently scrollable elements as well as a fixed frame. I think CSS is a really good approach, but some of the defaults simply suck.
  • 0
    @lbfalvy are you done yet talking about the web growing into an application platform? We get it!
  • 0
    @lbfalvy The vertical space is always unlimited. That's how a browser works. If you want it limited, then you must limit it yourself, in which case you have a container, in which case you can centre within that container. It's not rocket science.
  • 0
    1/2 @stackodev sorry, my latest comment about you was written impulsively.

    You see, CSS is amazingly, astonishingly beautiful. It cannot produce runtime errors. It achieves perfect separation between presentation and logic, just as Steve McConnell wanted, though it allows you to break it with pseudoelements if you need to.

    CSS can't produce runtime errors, and it doesn't even need a compiler to achieve that. CSS is amazingly performant — it enables you to do amazing things with just a few lines of code, and it only really lags when the problem you're trying to solve is algorithmically complex. In that case, you can't go faster than CSS in vector, the only thing that would be faster is to go scalar and use WebGL.

    In CSS, line order doesn't matter — they all apply together. To solve overrides, CSS introduces the amazing concept of specificity.
  • 1
    @kiki It's not my subject, it's my argument. I'm talking about unlimited vertical space being a unique property of bodies of text larger than the screen - something that Twitter for example explicitly avoids.
  • 1
    @Fast-Nop I know that's how the browser works, my point is that that's a really stupid assumption for a GUI engine to make about the app.
  • 0
    2/2 I have a computer science background. I've seen Haskell, C, Clojure (and Lisp), Prolog and other innovative languages. Still, CSS is my favorite programming language (yes, it's a programming language) by far, and the only thing that comes close is probably Lisp.

    Do you know why?

    Because CSS is only as complex as its domain area. It introduces the thinnest overhead I've ever seen. That's the pinnacle of software engineering.

    CSS is also dead specific and precise, just a fucking katana blade like C. If you write "transition: all", it will animate fucking ALL of it, even the process of resizing textarea with a mouse.

    Precise things usually require you to be extra careful. There are things that allow you to be sloppy, but they are not that precise.
  • 0
    3/2 Just as with C, with CSS you have to be careful, and while achieving this level of precision, CSS ALSO allows you to be sloppy. CSS changed how I think of programming entirely. I even met Hakon Wium Lee, the CSS creator, to thank them in person.

    So now go and read some books on tools you're fucking using, whatever they are. Maybe then you'll understand.
  • 0
    @lbfalvy The main problem isn't using a container, it's that many web devs lack any sort of structural thinking or even basic knowledge of HTML. They can't really see beyond "pixels on the screen" as if they were doing shit in MS Paint or so.
  • 2
    @kiki I was a CS major who switched to business IT because of dyscalculia which afflicts me with general “bad at math” issues, terrible short term/working memory as well as long term recall of complicated algorithms, structures, syntax, etc. Every bit of programming I do is excruciatingly slow compared to others and necessarily involves me looking up and re-looking up stuff most people have no problem remembering. My rant was after a whole day of attempting to get a bunch of decorative lines to behave themselves responsively on a design where nobody would care if those lines never existed. I want it to be easier because I need it to be easier, not because I’m lazy. And I wish there were something easier for all the “everyday” folks who try to roll their own websites but fail hard when CSS comes into play.

    Just my 2 cents.
  • 0
    @stackodev check out tailwind. Also, forget about setting width and height in pixels. Use paddings instead.

    Your website will become responsive almost instantly.
  • 0
    @stackodev It is easy. HTML has always been responsive from day 1, except tables of course. If your self-rolled website isn't responsive, it's because you coded some CSS to break responsiveness. You did it.
  • 1
    @kiki Tailwind is the same kind of stupid shit like Bootstrap and Bulma.
  • 0
    @stackodev an hour reading about CSS3 will ease much of your pain. No idea what you did to warrant the aggression there, it did used to be a mess and it still has that reputation.
  • 1
    @Fast-Nop if the prerequisite is "I don't want to learn CSS", tailwind is fine. Though I share your emotions on CSS frameworks overall
Add Comment