People are still using an antiquated CSS feature


​View this email in your browser (or share it with a friend!)

Hello Reader,

I’ve started collecting answers for a Family Feud style game called Asked 100 Devs (more on this at the very end of the email), and one of the questions I asked was “What is your favorite color format in CSS?”

I don’t want to spoil the results yet (I’ll be having some contestants on soon to try and guess the top answers to the questions), but something that caught me by surprise was that, of the answers for rgb, 80% of people said rgba() vs. rgb().

This really surprised me.

If so many people are still using rgba(), I guess it’s answers my question on my LLMs seem to always default to using it as well… but more importantly, not only do we not need the a in rgba() when including an alpha value, but the comma-separated syntax for colors isn’t how we should be writing them anymore.

Modern CSS color functions use the space-separated syntax. So, while rgb() and hsl() with commas will continue to work, if you want to use any of the new color functions, you have to use the space-separated syntax. That alone should be enough reason to switch to it in my opinion.

Modern CSS color functions use the space-separated syntax. So, while rgb() and hsl() with commas will continue to work, if you want to use any of the new color functions, you have to use the space-separated syntax. That alone should be enough reason to switch to it in my opinion.

On top of that, we also have one of my favorite modern CSS features, relative colors, which also use the space-separated syntax.

And I know people are going to tell me they will continue using rgba() and hsla() to support as many browsers as possible, which I’m all for… but just going to throw out there that gap for Flexbox gained support 2 years after the space-separated syntax, which has been supported in all the major browser engines since 2019.

If you want to continue to use rgba(), that’s completely fine, but so many people seem surprised when I talk about this, so I wanted to get the word out there a little more 🙂.

If you’d like to deep dive this more, a while ago I went a lot more into this and modern CSS colour features in a two-part series over on Piccalilli.

I also have some videos if you prefer:

🙋‍♂️ What I've been up to this week

📺 This library changes how JS and CSS work together

video preview​

At the end of his talk at CSS Day, Adam Argyle launched a new library, Prop for That, that passes a ton of useful information from JavaScript to CSS, and I took a look at it this week.

⚡ Don’t sleep on subgrid

video preview​

I’m a huge fan of subgrid. It raises the complexity of things, but when you plan things out properly, it can be super useful.

🔗 Other awesome stuff from around the web

And also a gentle reminder that the State of Devs survey is still open if you haven’t had a chance to answer it yet.

📝 Quiz time!

An element uses animation-timeline: view(). Which animation-range keyword makes the animation finish just as the element is fully on screen?

  • contain
  • cover
  • entry
  • exit

As usual, you'll have to head on over to YouTube to take a stab at the quiz, and once you answer, you'll see if you were right or not.

​

🏁

If you’d like to answer some of the questions I’m asking for my Asked 100 Devs thing, I’m not sending out newsletters when a new question goes up, since I’m only collecting 100 answers per question (and I’m asking a lot of questions).

If you’d like to answer some of them as they open up, I’d suggest following this Bluesky account that I set up for it. I only post there when new questions go live, and eventually when episodes are out.

Have a fantastic week!
Kevin


Are you looking to step up your CSS? I've got both free and premium courses to help with that! They cover a range of skill levels too 👇

Beginner friendly (and free)

HTML & CSS for Absolute Beginners

A free course that starts with the absolute basics, and gets to creating some layouts with Flexbox and Grid.

​Enroll →​

Intermediate

CSS Demystified

For those who've been writing CSS for a little bit now, but want to step up their game and start writing CSS with confidence!

​Enroll →​

Intermediate (Frontend Masters)

Build a Modern Site from Scratch

Build a fully responsive site using modern CSS features, along with some polished animations.

​Enroll → (25% off first month of Frontend Masters if you use this affiliate link)

​

If you no longer want to get any emails from me, you can unsubscribe or you can edit your preferences if you'd like pick which emails you get from me.
600 1st Ave, Ste 330 PMB 92768, Seattle, WA 98104-2246

Hi! I'm Kevin

Weekly newsletter, where I talk about tangentially-related front-end development topics and share what I've been up to in the last week, plus any cool/fun/interesting/useful links I come across as well.

Read more from Hi! I'm Kevin

View this email in your browser (or share it with a friend!) Hello Reader, Last week, I said most CSS problems come from a layer underneath the properties themselves. Here's one piece of that layer that almost nobody talks about. The browser creates boxes you never told it to. Take a simple <button class="button">Click me</button> There's one element there. But sometimes, there are two boxes... For example, if I did this: No typo here, this is using the two-keyword syntax for the display...

View this email in your browser (or share it with a friend!) PRE-S: You can help shape the future of the web by ranking the Interop 2027 proposals. There are a lot of them, but they’re just asking you to pick the ones that are important to you, and rank the ones you’ve picked. I’ll probably be sharing my ranks next week. Hello Reader, So it turns out that Opus 5.5 is very good at decompiling things. This has led to some mostly silly things, like Minecraft in Elden Ring and Mario in Halo, but...

View this email in your browser (or share it with a friend!) Hello Reader, I’ve been seeing questions like this one more and more often these days. I have a lot of thoughts on this that I’m trying to put together for something bigger, but these are the main reasons I keep making CSS tutorials: First, the obvious one: I like CSS! And I like to show what’s possible, and show that it can be fun and rewarding The second point, specifically showing what’s possible, I think is the important part....