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!

You want an element to transition from height: 0 to its natural height when opened. Which single line can make height: auto animatable?

  1. interpolate-size: allow-keywords
  2. transition-behavior: allow-discrete
  3. transition-size: auto
  4. will-change: height

As per 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, As part of my Asked 100 Devs game that I’m doing, I asked developers which CSS property they have to look up the syntax for most often. The video is in the section below, but one thing that I didn’t think of when putting the question together was that people often look a lot of things up 😅. I probably could have phrased the question better, asking about what they look up the most often, but I think it raised an...

View this email in your browser (or share it with a friend!) Hello Reader, A few years ago there was a common scam on YouTube where people would create fake accounts with the same profile picture as creators, but use a WhatsApp number as the name on the account, and then they'd use a bot to mass-reply to people saying to give them a call. It was a big problem, and I would actually get replies to those comments, as well as DMs and emails from people who tried to contact the number. As with...

View this email in your browser (or share it with a friend!) Hello Reader, Sometimes it can be hard to build momentum, and there are more and more things in our way now than ever. Social media has been one of the big ones for a long time now. For me, it can be an issue because it's part of my job. I probably should use some sort of scheduling app, but I tend to just go to Bluesky to post something, and then get distracted reading my feed. One issue I know more people are having is context...