JoshWComeau

Josh W Comeau homepage

Articles and Tutorials

The Undeniable Utility Of CSS :has

Of all the latest and greatest CSS features, the “:has” pseudo-class wasn’t exactly at the top of my wishlist. Once I started using it, however, I kept discovering incredible things I could do with it. It’s now become a core part of my toolkit! In this blog post, I'll show you some practical real-world problems I solved using “:has”, as well as some wild experiments that blew my mind!

Read more: The Undeniable Utility Of CSS <code>:has</code>
Promises From The Ground Up

The “Promises” API is a surprisingly tricky part of modern JavaScript. Without the right context, it doesn’t make much sense at all! In this tutorial, you’ll build an intuition for how Promises work by getting a deeper understanding of JavaScript and its limitations.

Read more: Promises From The Ground Up
CSS in React Server Components

Understanding the future of CSS-in-JS and React

You can’t make an omelette without cracking a few eggs, and when the core React team unveiled their vision for the future of React, some of my favourite libraries got scrambled 😅. In this blog post, we’re going to explore the compatibility issues between React Server Components and CSS-in-JS libraries like styled-components. You’ll understand what the issue is, what the options are, and what’s on the horizon.

Read more: CSS in React Server Components
How To Center a Div

The Ultimate Guide to Centering in CSS

Back in the day, centering an element was one of the trickiest things in CSS. As the language has evolved, we’ve been given lots of new tools we can use… But how do we pick the best option? When do we use Flexbox, or CSS Grid, or something else? Let's dig into it.

Read more: How To Center a Div
An Interactive Guide to CSS Grid

CSS Grid is an incredibly powerful tool for building layouts on the web, but like all powerful tools, there's a significant learning curve. In this tutorial, we'll build a mental model for how CSS Grid works and how we can use it effectively. I'll share the biggest 💡 lightbulb moments I've had in my own learning journey.

Read more: An Interactive Guide to CSS Grid
Making Sense of React Server Components

This year, the React team unveiled something they've been quietly researching for years: an official way to run React components exclusively on the server. This is a significant paradigm shift, and it's caused a whole lot of confusion in the React community. In this tutorial, we'll explore this new world, and build an intuition for how it works, and how we can take advantage of it.

Read more: Making Sense of React Server Components
Animated Pride Flags

Happy Pride month! In this tutorial, I'll share a handful of my favourite animation tricks. You'll learn how to build an animated wavy pride flag using CSS keyframes and linear gradients. We'll also see how to make it dynamic using React. 🏳️‍🌈

Read more: Animated Pride Flags
The “const” Deception

Exploring the difference between assignment and mutation in JavaScript

The “const” keyword in JavaScript is used to create constants, variables that can't change. Curiously, though, we do seem to be able to edit objects and arrays that are created using “const”. In this tutorial, we're going to dig into the incredibly-important distinction between “assignment” and “mutation” in JavaScript.

Read more: The “const” Deception
The End of Front-End Development

Large language models like GPT-4 are becoming increasingly capable, at an alarming rate. Within a couple of years, we won't need developers any more! …Or at least, that's the narrative going viral on Twitter. I'm much more optimistic about what these AI advancements mean for the future of software development.

Read more: The End of Front-End Development
Common Beginner Mistakes with React

Pitfalls, gotchas, and footguns, oh my!

I used to teach React at a local coding bootcamp, and I noticed that students kept getting tripped up by the same handful of things. In this article, we're going to go through 9 of the most dastardly gotchas. I'll show you how to solve these common problems, so you can avoid a lot of potential frustration!

Read more: Common Beginner Mistakes with React

Browse By Category

Popular Content

  1. An Interactive Guide to Flexbox
  2. An Interactive Guide to CSS Transitions
  3. A Modern CSS Reset
  4. The End of Front-End Development
  5. CSS Variables for React Devs
  6. Designing Beautiful Shadows in CSS
  7. How To Center a Div
  8. Why React Re-Renders
  9. Making Sense of React Server Components
  10. An Interactive Guide to CSS Grid