An overview of what makes modern CSS so awesome.

all 15 comments

sorted by: hot top controversial new old
[–] 11 points 1 year ago* (last edited 1 year ago) (2 children)

I wish there was a comprehensive resource for CSS. I’ve known for a very long time that I don’t know the half of it. But randomly clicking through the MDN topics has a very [Edit: low high] cost to benefit ratio. Where do you learn about the gems of CSS without getting bogged down by the obscure topics like text-emphasis-style?

  • source
  • hideshow 2 child comments
  • [–] 9 points 1 year ago
    :root {
      color-scheme: light dark;
      --text: light-dark(#000, #FFF);
      --bg: light-dark(#EEE, #242936);
    }
    

    Hmm, I guess the advantage of that over

    @media (prefers-color-scheme: dark) {
        /*set different values for variables*/
    }
    

    is that you can set the color scheme via a button much more easily then.

    Had to think about that for a moment, because the old way of doing things seemed fine, but that is a pretty good reason, I guess.

  • source
  • [–] 7 points 1 year ago (2 children)
    • you've never needed javascript
  • source
  • hideshow 2 child comments
  • [–] 1 point 8 months ago

    There was a time where you really needed Javascript and the Javascript you needed did not exist yet so you actually needed Flash.

    If all your site did was display static content or maybe POST to a php back-end, sure, JS was optional. But if you wanted a website to do anything, or look like more than a jumped-up Word document, then JS was your only sane option until maybe 2011. And even then the Javascript you needed was actually jQuery.

  • source
  • parent
  • [–] 7 points 1 year ago* (1 child)

    I bookmarked another post from this community that might relate nicely!
    It's time for modern CSS to kill the SPA

    Haven't gotten to trying all the cool css stuff in my own projects yet, but it certainly sounds interesting :D

  • source
  • hideshow 1 child comment
  • [–] 7 points 1 year ago* (last edited 1 year ago)

    I believe a lot of the negativity towards CSS stems from not really knowing how to use it. Many developers kind of just skip learning the CSS fundamentals in favor of the more interesting Java- and TypeScript, and then go on to complain about a styling language they don’t understand.

    My negativity towards CSS is that it was made by people who used to style newspapers and the terminology plus way of thinking was just copy-pasted to the digital world where things aren't the same. For example, the display property has so many values that I don't understand... same goes for position and a bunch of other properties and how they interact. Sometimes setting one property can completely invalidate another one. position, display and width or height are examples of that.

    The major problem with CSS is that it's a language which requires a lot of memorisation, not understanding. Unlike programming languages where you can reason why things have to be written a certain way from a point of understanding, with CSS the why is often "because it worked that way when I tried it".

    To understand why certain things work or don't in CSS, you have to understand typesettings,maybe color theory, browser history, and a bunch of other things. It's not a surprise that most people memorise CSS stuff.

    I compare it to our current school system: it's very good for people who can/enjoy memorizing things (at least until the test). For those who care more or are better at understanding and reasoning, it is hell. CSS is like our school system.

    Anti Commercial-AI license

  • source
  • [–] 6 points 1 year ago (3 children)

    That’s great and wonderful, except some of those things don’t work on an iPhone. As long as Apple is holding back the industry, we’ll have to use JS for some things.

  • source
  • hideshow 3 child comments
  • [–] 3 points 1 year ago

    with so many wasm frameworks you can use any language you like

  • source
  • 8 comments in c/technology@lemmy.world view that post
    [–] 13 points 8 months ago* (last edited 8 months ago)

    "But CSS sucks”

    I believe a lot of the negativity towards CSS stems from not really knowing how to use it. Many developers kind of just skip learning the CSS fundamentals in favor of the more interesting Java- and TypeScript, and then go on to complain about a styling language they don’t understand.

    True. I did a HTML+CSS-only gallery when CSS3 just came out. And was positively surprised a few days ago, that a online gallery viewer had a shareable URL per picture (GET request).

    While JS forms should just die. They always lose the content on reload or failed send (because of brittle client-side JS send, instead of using age-old browser-features).

  • source
  • [–] 6 points 8 months ago

    Sadly the linked example doesn’t seem to work on ios.

  • source
  • [–] 5 points 8 months ago (4 children)

    Personally I like using server side rendering when I can. The UI should be as light weight as possible and you can do a lot with just HTML and CSS. That said, it's pretty hard to build a responsive web app without at least a little bit of JavaScript.

  • source
  • hideshow 4 child comments
  • [–] 8 points 8 months ago (1 child)

    I'm the other way around. For me, the UI can be chonky frameworks or whatever as long as the user experience is good and it works on lots of platforms.

    But keep every bit of UI out of my back-end systems. The data and business logic layers should be so divorced from the UI that they didn't even get visitation rights with the kids.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 8 months ago* (last edited 8 months ago)

    That said, it's pretty hard to build a responsive web app without at least a little bit of JavaScript.

    Not really. You just need to learn the difference between width and max-width.
    I do UserCSS now and then and 2 of 3 sites use them wrong. That and position: fixed overuse. Also, use @media (min-width) only for layout changes, not for sizing.

    And also, functionality/layouting first, design after.

  • source
  • parent
  • [–] 0 points 8 months ago

    That said, it’s pretty hard to build a responsive web app without at least a little bit of JavaScript.

    And then the question comes up, why would you need responsiveness. Auto-completion of search results? Hate that crap. Endless scroll with loading additional contents? Hate that crap. Everything blinking and whistling? I suppose JS in that case is possible, but purely for stylistic purposes and not functionality.

  • source
  • parent
  • [–] 1 point 8 months ago

    I feel JavaScript should be more of a backend scripting language, like with Node, than a frontend. PHP can already accomplish a lot of what JS can do, just on the server-side as opposed to client-side.

    PHP+CSS is really all you need to make something feel good. People often use JS to make a site look good, yet it usually suffers in functionality.

  • source