My "new" favorite CSS trick


โ€‹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 switching with the rise of LLMs and AI tools.

The promise has always been that these will help us be more productive, but that promise often simply leads to more context switching than ever before.

Between prompting something while also writing some code yourself, if not running multiple agents at the same time, you end up jumping all over the place, and context switching is one of the worst things we can do when it comes to actually getting things done.

โ€‹Jason Lengstorf has a great post on this (not the AI part, just the idea that multitasking is a terrible idea) that does caveat that there are exceptions for some people

The real trouble is that it's so hard to tell, because multitasking often makes us feel more productive, but feeling productive and being productive don't always go hand in hand.

The days where I finish a day and feel like I got a lot done? They're the ones where I just sat down and did the thing(s) I needed to do, not the sidequests that kept popping up as I went.

I know this really depends on the type of work you do, but batching can really help because it allows us to stay on a single type of task for a long period, but then of course they make productivity tools for batching that just end up being one more place to check, with their own notifications and other distractions... in other words it fixes one thing, while potentially adding a few new ones into the mix ๐Ÿ˜….

All of this is to say that I generally think any sort of productivity hack or solution is often just a sidequest. It's become such a big industry, but if all of these tools and solutions worked as well as they promise, then there would be no need for new ones.

And I'm writing all this because my last week was incredibly busy, but also incredibly unproductive now that I'm sitting at the end of it and looking at what I've actually accomplished!

Anyway, onto the CSS trick I promised in the subject line.

๐Ÿ™‹โ€โ™‚๏ธ What Iโ€™ve been up to this week

๐Ÿ“บ My new favourite CSS trick

video previewโ€‹

Itโ€™s always fun when you come across something new, only to realize that others have been using it for over five years, which is the case here where I looked at how we can create a conditional border radius depending on if an element is touching the edge of the viewport or its parent.

I did go slightly more of a modern approach than Ahmad did in his post from 2021, using 1e5 to create a big number, and also using container query units, and as a commenter pointed out, I could have gone even more modern by using sign()!

Some people have asked why I didn't use infinity. It is a valid number in CSS (so it -infinity), but for some reason it doesn't work here. I'm digging into why that is.

But for now, if you need bulletproof browser support you could use 9999, if you don't mind using something a bit more modern, you can use an exponent like I did, which has decent support, and if you're okay with a bit more cutting edge, then you can use sign().


โšก What framework do developers like the most?

video previewโ€‹

The first proper Family Feud round is out, with Adam Argyle as my first guest, where he tries to guess what peopleโ€™s favourite framework is.


๐Ÿ  Design Systems House

video previewโ€‹

I was a guest on Donnie D'Amato's show Design Systems House, where we talked about teaching, CSS, and more.

๐Ÿ“ 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.

โ€‹

๐Ÿ

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, On the main channel this week, I looked at building errors into your CSS so people know when they're using a component or UI element the wrong way. Itโ€™s a fun concept, but as I mentioned in the video, if you find that a lot of people are misusing something, you should probably ask why that is, and depending on the types of ways theyโ€™re misusing things, one solution might be making them more adaptable by providing...

I'm going to be sending more emails than usual over the next 2 weeks for my Black Friday sale. If you'd prefer not to get them, you can opt out of these sales emails. Hello Reader, Over the last few weeks, Iโ€™ve been sharing bits of the new module Iโ€™ve been writing for CSS Demystified, and Iโ€™m super excited to let you know itโ€™s finally ready! To celebrate, I've made it my Black Friday sale this year, with 32% off until Wednesday, December 2. If youโ€™ve been reading my emails or watching my...

View this email in your browser (or share it with a friend!) Hello Reader, Before we get into this week's content, about an hour before this email was scheduled to be sent, I realized I scheduled it wrong ๐Ÿ˜…. This one was supposed to go out last week, and I'd already written up another email for this week. So, sorry for missing last weeks email! The What I've been up to this week section has more than usual, since it covers the last couple of weeks. One thing Iโ€™m a big fan of is writing robust...