Hi! Sorry to interrupt, but I'm currently looking for work.
If you know anyone looking for a recent CompSci graduate with deep experience in strictly-typed languages like Rust, please send the listing to me or send my Resume over!
I'm based in Brighton, UK and looking for roles in and around the London area, or remote. Thanks!


   (Sets a cookie in your browser)

Squircles in CSS!

A brief on the new corner-shape property.

🕒


Just wanted to shout out this cool new feature coming to CSS: you can now specify exactly how round you want your border-radii to be.

A normal radius would look like this:

 

The border corners are just arcs of circles. This is what the new property looks like:

css
corner-shape: notch; /* or superellipse(-infinity) */
corner-shape: scoop; /* or superellipse(-1) */
corner-shape: bevel; /* or superellipse(0), a straight line */
corner-shape: round; /* or superellipse(1), default. */
corner-shape: squircle; /* or superellipse(2) */
corner-shape: square; /* or superellipse(infinity) */
/* You can also specify each corner separately. */
corner-shape: square squircle bevel scoop; /* top-left, top-right, bottom-right, bottom-left */

Lined up, they look like this:

Your browser supports corner-shape.
 
Notch
 
Scoop
 
Bevel
 
Round
 
Squircle
 
Square
Your browser does not support corner-shape. A rendered image is provided.
a few diagrams of each corner shape

You might want to use this effect for mimicking an iOS-style squircle, since previous ways of doing this had to use SVG masks. If you want to see more interesting ways of using this new feature, see CSS-Tricks article about it. (I think we might have a good replacement for the classic CSS Triangle!)

Further Reading

Footnotes

  1. Squircles, and other superellipses, are a real thing, not just a silly name. MDN has a good explanation on this.
  2. Here's the codepen. You have my utmost respect if you can just write SVGs like this.