• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

What Can We Truly Do With corner-shape?

Admin by Admin
September 12, 2025
Home Coding
Share on FacebookShare on Twitter


Once I first began messing round with code, rounded corners required 5 background photographs or an picture sprite possible created in Photoshop, so when border-radius got here onto the scene, I bear in mind all people pondering that it was the most effective factor ever. Net designs had been very sq. on the time, so to have border-radius was tremendous cool, and it saved us a whole lot of time, too.

Chris’ border-radius article from 2009, which on the time of writing is 16 years previous (wait, how previous am I?!), contains vendor prefixes for older internet browsers, together with “previous Konqueror browsers” (-khtml-border-radius). What a time to be alive!

We’re a lot much less enthusiastic about rounded corners these days. The truth is, sharp corners have made a comeback and are simply as standard now, as are squircles (square-ish circles or circle-y squares, take your choose), which is precisely what the corner-shape CSS property allows us to create (along with many different cool UI results that I’ll be strolling you thru in the present day).

On the time of writing, solely Chrome 139 and above helps corner-shape, which should be used with the border-radius property or/and any of the associated particular person properties (i.e., border-top-left-radius, border-top-right-radius, border-bottom-right-radius, and border-bottom-left-radius):

Five vertically-stacked containers in purple comparing the effects of different corner-shape values.

Snipped corners utilizing corner-shape: bevel

These snipped corners have gotten an increasing number of standard as UI designers embrace brutalist aesthetics.

Black button with snipped corners at the upper-left and lower-right that reads ‘Grab your ticket.’

Within the instance above, it’s as simple as utilizing corner-shape: bevel for the snipped corners impact after which border-bottom-right-radius: 16px for the dimensions.

corner-shape: bevel;
border-bottom-right-radius: 16px;

We will do the identical factor and it actually works with a cyberpunk aesthetic:

A rectangular container with a medium bright red border flanked by two tab buttons above it with a beveled bottom-right corner.

Slanted sections utilizing corner-shape: bevel

Slanted sections is a visible impact that’s much more standard, most likely not going wherever, and once more, helps parts to look lots much less just like the containers that they’re.

Earlier than we dive in although, it’s necessary to needless to say every border radii has two semi-major axes, a horizontal axis and a vertical axis, with a ‘level’ (to make use of vector terminology) on every axis. Within the instance above, each are set to 16px, so each factors transfer alongside their respective axis by that quantity, away from their nook in fact, after which the beveled line is drawn between them. Within the slanted part instance beneath, nevertheless, we have to provide a unique level worth for every axis, like this:

corner-shape: bevel;
border-bottom-right-radius: 100% 50px;

A large section heading against a solid purple background with white lettering. The container’s bottom-right corner is clipped, giving the container a slanted bottom edge.

The primary level strikes alongside 100% of the horizontal axis whereas the second level travels 50px of the vertical axis, after which the beveled line is drawn between them, creating the slant that you simply see above.

By the way in which, having totally different values for every axis and border radius is precisely how these cool border radius blobs are made.

Sale tags utilizing corner-shape: spherical bevel bevel spherical

You’ve see these sale tags on virtually each e-commerce web site, both as photographs or with rounded corners and never the sharp half (different strategies simply aren’t well worth the bother). However now we are able to carve out the right form utilizing two several types of corner-shape directly, in addition to a complete set of border radius values:

Red rectangular box with rounded corners on the left and beveled corners on the right forming an arrow shape with the label ‘Sale’ in white.

You’ll want corner-shape: spherical bevel bevel spherical to begin off. The order flows clockwise, ranging from the top-left, as follows:

  • top-left
  • top-right
  • bottom-right
  • bottom-left

Identical to with border-radius. You can omit some values, inflicting them to be inferred from different values, however each the inference logic and ensuing worth syntax lack readability, so I’d simply keep away from this, particularly since we’re about to discover a extra complicated border-radius:

corner-shape: spherical bevel bevel spherical;
border-radius: 16px 48px 48px 16px / 16px 50% 50% 16px;

Left of the ahead slash (/) we’ve got the horizontal-axis values of every nook within the order talked about above, and on the suitable of the /, the vertical-axis values. So, to be clear, the primary and fifth values correspond to the identical nook, as do the second and sixth, and so forth. You possibly can unpack the shorthand if it’s simpler to learn:

border-top-left-radius: 16px;
border-top-right-radius: 48px 50%;
border-bottom-right-radius: 48px 50%;
border-bottom-left-radius: 16px;

Up till now, we’ve probably not wanted to completely perceive the border radius syntax. However now that we’ve got corner-shape, it’s positively price doing so.

As for the precise values, 16px corresponds to the spherical corners (this one’s simple to grasp) whereas the 48px 50% values are for the bevel ones, that means that the corners are ‘drawn’ from 48px horizontally to 50% vertically, which is why and the way they head into some extent.

Concerning borders — sure, the sharp components would look nicer in the event that they had been barely rounded, however utilizing borders and defines on these parts yields unpredictable (however I believe supposed) outcomes attributable to how browsers draw the corners, which sucks.

Arrow crumbs utilizing the identical technique

Yep, similar factor.

A rounded rectangular box in three purple arrow-shaped segments pointing towards the right. Each segment is a breadcrumb, labeled Step 1, Step 2, and Step 3 in white. The first segment is a darker shade of purple.

We basically have a grid row with damaging margins, however as a result of we are able to’t create ‘inset’ arrows or use borders/outlines, we’ve got to create an impact the place the pretend borders of sure arrows bleed into the following. That is performed by nesting the very same form within the arrows after which making use of one thing to the impact of padding-right: 3px, the place 3px is the worth of the would-be border. The code feedback beneath ought to clarify it in additional element (the entire code in the Pen is kind of attention-grabbing, although):

  1. Step 1
  2. Step 2
  3. Step 3
ol {
  /* Clip n’ spherical */
  overflow: clip;
  border-radius: 16px;

  li {
    /* Arrow colour */
    background: hsl(270 100% 30%);

    /* Reverses the z-indexes, making the arrows stack */
    /* End result: 2, 1, 0, ... (sibling-x requires Chrome 138+) */
    z-index: calc((sibling-index() * -1) + sibling-count());

    &:not(:last-child) {
      /* Arrow width */
      padding-right: 3px;

      /* Arrow form */
      corner-shape: bevel;
      border-radius: 0 32px 32px 0 / 0 50% 50% 0;

      /* Pull the following one into this one */
      margin-right: -32px;

    }

    a {
      /* Similar form */
      corner-shape: inherit;
      border-radius: inherit;

      /* Overlay background */
      background: hsl(270 100% 50%);
    }
  }
}

Tooltips utilizing corner-shape: scoop

Small purple button with white text and a red outline next to a red tooltip with white text floated to the right and a styled caret tip on the left side making it connected to the button.

To create this tooltip type, I’ve used a popover, anchor positioning (to place the caret relative to the tooltip), and corner-shape: scoop. The caret form is similar because the arrow form used within the examples above, so be happy to change scoop to bevel in case you choose the traditional triangle tooltips.

A fast walkthrough:





Don’t eat yellow snow

#tooltip {
  /* Outline anchor */
  anchor-name: --tooltip;

  /* Mandatory reset */
  margin: 0;

  /* Heart vertically */
  align-self: anchor-center;

  /* Pin to proper facet + 15 */
  left: calc(anchor(proper) + 15px);

  &::after {
    /* Create caret */
    content material: "";
    width: 5px;
    peak: 10px;
    corner-shape: scoop;
    border-top-left-radius: 100% 50%;
    border-bottom-left-radius: 100% 50%;

    /* Anchor to tooltip */
    position-anchor: --tooltip;

    /* Heart vertically */
    align-self: anchor-center;

    /* Pin to left facet */
    proper: anchor(left);

    /* Popovers have this already (required in any other case) */
    place: fastened;
  }
}

For those who’d fairly these had been hover-triggered, the upcoming Curiosity Invoker API is what you’re on the lookout for.

Lifelike highlighting utilizing corner-shape: squircle bevel

The factor, used for semantic highlighting, defaults with a yellow background, nevertheless it doesn’t precisely create a highlighter impact. By including the next two strains of CSS, which admittedly I found by experimenting with utterly random values, we are able to make it look extra like a hand-waved spotlight:

mark {
  /* A...squevel? */
  corner-shape: squircle bevel;
  border-radius: 50% / 1.1rem 0.5rem 0.9rem 0.7rem;

  /* Prevents background-break when wrapping */
  box-decoration-break: clone;
}

Text reading ‘Highlighted text’ in black against a yellow background containing no sharp edges.

We will additionally use squircle by itself to create these fancy-rounded app icons, or use them on buttons/playing cards/type controls/and so on. in case you assume the ‘previous’ border radius is beginning to look a bit stale:

Squircle shaped box filled with a linear gradient that goes from orange to blue with white text on top that says ‘CSS’.

Squircle-shaped purple button with a white label that says ‘Button.’

Hand-drawn containers utilizing the identical technique

Similar factor, solely bigger. Form of appears to be like like a hand-drawn field?

Solid white rectangular box with thick, black borders that look hand-drawn.

Admittedly, this impact doesn’t look as superior on a bigger scale, so in case you’re actually trying to wow and create one thing extra akin to the Crimson Lifeless Redemption aesthetic, this border-image strategy could be higher.

Clip a background with corner-shape: notch

Notched border radii are ugly and I received’t hear in any other case. I don’t assume you’ll need to use them to create a visible impact, however I’ve discovered that they’re helpful for background clipping in case you set the irrelevant axis to 50% and the axis of the facet that you simply need to clip by the quantity that you simply need to clip it by. So in case you wished to clip 30px off the background from the left for instance, you’d select 30px for the horizontal axes and 50% for the vertical axes (for the -left-radius properties solely, in fact).

corner-shape: notch;
border-top-left-radius: 30px 50%;
border-bottom-left-radius: 30px 50%;

The words ‘Clipped background’ in bold black letters with a thinly-bordered rectangle that nearly covers the text.

Conclusion

So, corner-shape is definitely a helluva lot of enjoyable. It definitely has extra makes use of than I anticipated, and little question with some experimentation you’ll provide you with some extra. With that in thoughts, I’ll depart it to you CSS-Tricksters to fiddle with (bear in mind although, you’ll must be utilizing Chrome 139 or larger).

As a parting present, I depart you with this very cool however utterly ineffective CSS Tie Fighter, made with corner-shape and anchor positioning:

Hexagon shape with six black segments forming the shape, separated by gaps of gray space. The negative space in the middle forms another hexagon.

Tags: cornershape
Admin

Admin

Next Post
HubSpot’s Transactional Electronic mail Pricing Information — Important Enterprise Communication Add-On

HubSpot's Transactional Electronic mail Pricing Information — Important Enterprise Communication Add-On

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

What Is llms.txt, and Ought to You Care About It?

What Is llms.txt, and Ought to You Care About It?

April 22, 2025
Expedition 33 And Extra New Video games

Expedition 33 And Extra New Video games

April 27, 2025

Trending.

Microsoft Launched VibeVoice-1.5B: An Open-Supply Textual content-to-Speech Mannequin that may Synthesize as much as 90 Minutes of Speech with 4 Distinct Audio system

Microsoft Launched VibeVoice-1.5B: An Open-Supply Textual content-to-Speech Mannequin that may Synthesize as much as 90 Minutes of Speech with 4 Distinct Audio system

August 25, 2025
New Assault Makes use of Home windows Shortcut Information to Set up REMCOS Backdoor

New Assault Makes use of Home windows Shortcut Information to Set up REMCOS Backdoor

August 3, 2025
Begin constructing with Gemini 2.0 Flash and Flash-Lite

Begin constructing with Gemini 2.0 Flash and Flash-Lite

April 14, 2025
The most effective methods to take notes for Blue Prince, from Blue Prince followers

The most effective methods to take notes for Blue Prince, from Blue Prince followers

April 20, 2025
Stealth Syscall Method Permits Hackers to Evade Occasion Tracing and EDR Detection

Stealth Syscall Method Permits Hackers to Evade Occasion Tracing and EDR Detection

June 2, 2025

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

Learn how to Watch ‘Survivor’: Stream Season 49 With out Cable

Learn how to Watch ‘Survivor’: Stream Season 49 With out Cable

September 22, 2025
Watch The Sims 4 Journey Awaits gameplay right here

Watch The Sims 4 Journey Awaits gameplay right here

September 22, 2025
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved