{"id":393431,"date":"2026-05-08T07:54:10","date_gmt":"2026-05-08T13:54:10","guid":{"rendered":"https:\/\/css-tricks.com\/?p=393431"},"modified":"2026-05-08T07:55:17","modified_gmt":"2026-05-08T13:55:17","slug":"using-css-corner-shape-for-folded-corners","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/using-css-corner-shape-for-folded-corners\/","title":{"rendered":"Using CSS\u00a0corner-shape\u00a0For Folded Corners"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I came across <a href=\"https:\/\/kittygiraudel.com\/2026\/03\/05\/folded-corner-with-css\/\" rel=\"noopener\">Kitty Giraudel\u2019s folded corners technique<\/a>. It leverages CSS <code>clip-path<\/code>, and I thought that that was such a cool way to do it. <code>clip-path<\/code> has been trending lately, most likely because web browsers support the <a href=\"https:\/\/css-tricks.com\/almanac\/functions\/s\/shape\/\"><code>shape()<\/code><\/a> function now.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, I\u2019ve been on a bit of a <code>corner-shape<\/code> kick lately (have a look at my <a href=\"https:\/\/css-tricks.com\/what-can-we-actually-do-with-corner-shape\/\">introduction to <code>corner-shape<\/code><\/a> as well as these <a href=\"https:\/\/css-tricks.com\/experimenting-with-scroll-driven-corner-shape-animations\/\">scroll-driven <code>corner-shape<\/code> animations<\/a>), so I figured that <code>corner-shape<\/code> could be used to create folded corners as well, and this is what I came up with:<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_EagyxrX\" src=\"\/\/codepen.io\/anon\/embed\/EagyxrX?height=450&amp;theme-id=1&amp;slug-hash=EagyxrX&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed EagyxrX\" title=\"CodePen Embed EagyxrX\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1768\" height=\"916\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=1768%2C916&#038;ssl=1\" alt=\"White paper with the top-right corner folded in.\" class=\"wp-image-393432\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?w=1768&amp;ssl=1 1768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=1024%2C531&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=768%2C398&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=1536%2C796&amp;ssl=1 1536w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So open Chrome, which supports <code>corner-shape<\/code>, and let\u2019s dig in (if you\u2019re looking at this in other browsers, it basically falls back to a rounded corner).<\/p>\n\n\n\n\n<baseline-status class=\"wp-block-css-tricks-baseline-status\" featureId=\"corner-shape\"><\/baseline-status>\n\n\n\n\n<baseline-status class=\"wp-block-css-tricks-baseline-status\" featureId=\"container-style-queries\"><\/baseline-status>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-1-set-some-css-variables\">Step 1: Set some CSS variables<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Elements have four corners, but when we use <code>border-radius<\/code>, each corner is split into two coordinates. The x-axis coordinate moves along the x-axis, away from its associated corner, while the y-axis coordinate does the same thing along the y-axis. It\u2019s from these coordinates that <code>border-radius<\/code> draws the curvature of the rounded corners.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1665\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?resize=2560%2C1665&#038;ssl=1\" alt=\"Diagramming the shape showing border-radius applied to the bottom-left corner. The rounded corner is 50% on the y-axis and 50% on the x-axis.\" class=\"wp-image-392507\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?w=2560&amp;ssl=1 2560w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?resize=300%2C195&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?resize=1024%2C666&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?resize=768%2C499&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?resize=1536%2C999&amp;ssl=1 1536w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/s_4A82C1A16CF8BD3E78A39757A7700A0B223569FCA13B21C3FBDA9426FB071038_1771786781751_3-scaled.png?resize=2048%2C1332&amp;ssl=1 2048w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">First, store the coordinates as CSS variables. We\u2019ll need the values that they hold more than once, so this simplifies things, makes the fold animatable, and maintains some degree of realism.<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">:root {\n  \/* x-axis coordinate *\/\n  --x-coord: 9rem;\n\n  \/* y-axis coordinate *\/\n  --y-coord: 5rem;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2-establishing-the-fold\">Step 2: Establishing the fold<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Given what we now know about <code>border-radius<\/code>, it should be obvious what <code>border-top-right-radius<\/code> does. As for <code>corner-top-right-shape: bevel<\/code>, that ensures that a straight line is drawn between the coordinates instead of rounded corners (<code>corner-top-right-shape: round<\/code>). That\u2019s right, <code>border-radius<\/code> <em>includes<\/em> <code>corner-shape: round<\/code> by default (behind the scenes, of course).<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">\/* Square *\/\ndiv {\n  \/* Place coordinates *\/\n  border-top-right-radius: var(--x-coord) var(--y-coord);\n\n  \/* Draw line between coordinates *\/\n  corner-top-right-shape: bevel;\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_xbEjoEy\" src=\"\/\/codepen.io\/anon\/embed\/xbEjoEy?height=450&amp;theme-id=1&amp;slug-hash=xbEjoEy&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed xbEjoEy\" title=\"CodePen Embed xbEjoEy\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1768\" height=\"916\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703905116_2-1.png?resize=1768%2C916&#038;ssl=1\" alt=\"White paper with a diagonal cut in the top-right corner.\" class=\"wp-image-393437\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703905116_2-1.png?w=1768&amp;ssl=1 1768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703905116_2-1.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703905116_2-1.png?resize=1024%2C531&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703905116_2-1.png?resize=768%2C398&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703905116_2-1.png?resize=1536%2C796&amp;ssl=1 1536w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-3-creating-the-flip-side\">Step 3: Creating the flip side<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we\u2019ve established the fold, it\u2019s time to create the flip side. Start by selecting <code>::before<\/code>, then declare <code>content: \"\"<\/code> to create the element without content. The <code>background<\/code> can be inherited from the square, and the dimensions should leverage the coordinates that we saved. As you can see, I\u2019ve also added a <code>box-shadow<\/code> where the blur radius scales with <code>--x-coord<\/code> and <code>--y-coord<\/code>, but you\u2019re welcome to adapt the formula as you see fit.<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">\/* Square *\/\ndiv {\n  \/* Place coordinates *\/\n  border-top-right-radius: var(--x-coord) var(--y-coord);\n\n  \/* Draw line between coordinates *\/\n  corner-top-right-shape: bevel;\n\n  \/* Flip side *\/\n  &amp;::before {\n    \/* Generate empty element *\/\n    content: \"\";\n\n    \/* Inherit background *\/\n    background: inherit;\n\n    \/* Same as coordinates *\/\n    width: var(--x-coord);\n    height: var(--y-coord);\n\n    \/* Scale blur radius with --x-coord and --y-coord *\/\n    box-shadow: 0 0 calc((var(--x-coord) + var(--y-coord)) \/ 3) #00000050;\n  }\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_GgjdbpK\" src=\"\/\/codepen.io\/anon\/embed\/GgjdbpK?height=450&amp;theme-id=1&amp;slug-hash=GgjdbpK&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed GgjdbpK\" title=\"CodePen Embed GgjdbpK\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1768\" height=\"916\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703996642_3.png?resize=1768%2C916&#038;ssl=1\" alt=\"White paper with s white rectangle in the top-left corner and a diagonal cut in the top-right corner.\" class=\"wp-image-393435\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703996642_3.png?w=1768&amp;ssl=1 1768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703996642_3.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703996642_3.png?resize=1024%2C531&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703996642_3.png?resize=768%2C398&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775703996642_3.png?resize=1536%2C796&amp;ssl=1 1536w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-4-positioning-the-flip-side-before-\">Step 4: Positioning the flip side (<code>::before<\/code>)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we need to shift <code>::before<\/code> to the (top-)right corner. We\u2019re avoiding <a href=\"https:\/\/css-tricks.com\/css-anchor-positioning-guide\/\">anchor positioning<\/a>, because there\u2019s no need for modern features if more supported features work well using the same amount of code. So, declare <code>position: relative<\/code> on the square and <code>position: absolute<\/code> on <code>::before<\/code>. This makes <code>::before<\/code> position relative to the square, and is a trick that only works for parent-child relationships. Actually, this shortcoming is why anchor positioning was invented, but we just don\u2019t need it in this case.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition, declare <code>inset: 0 0 auto auto<\/code> on <code>::before<\/code> to align it to the top-right corner of the square, and <code>overflow: clip<\/code> <em>on the square<\/em> to clip the half of <code>::before<\/code> that overflows it.<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">\/* Square *\/\ndiv {\n  \/* Place coordinates *\/\n  border-top-right-radius: var(--x-coord) var(--y-coord);\n\n  \/* Draw line between coordinates *\/\n  corner-top-right-shape: bevel;\n\n  \/* Clip any overflow *\/\n  overflow: clip;\n\n  \/* For alignment *\/\n  position: relative;\n\n  \/* Flip side *\/\n  &amp;::before {\n    \/* Generate empty element *\/\n    content: \"\";\n\n    \/* Inherit background *\/\n    background: inherit;\n\n    \/* Same as coordinates *\/\n    width: var(--x-coord);\n    height: var(--y-coord);\n\n    \/* Scale blur radius with --x-coord and --y-coord *\/\n    box-shadow: 0 0 calc((var(--x-coord) + var(--y-coord)) \/ 3) #00000050;\n\n    \/* For alignment *\/\n    position: absolute;\n\n    \/* Align to top-right *\/\n    inset: 0 0 auto auto;\n  }\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_pvEZvax\" src=\"\/\/codepen.io\/anon\/embed\/pvEZvax?height=550&amp;theme-id=1&amp;slug-hash=pvEZvax&amp;default-tab=result\" height=\"550\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed pvEZvax\" title=\"CodePen Embed pvEZvax\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1768\" height=\"916\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704182876_4.png?resize=1768%2C916&#038;ssl=1\" alt=\"White paper with the top-right corner folded in.\" class=\"wp-image-393434\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704182876_4.png?w=1768&amp;ssl=1 1768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704182876_4.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704182876_4.png?resize=1024%2C531&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704182876_4.png?resize=768%2C398&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704182876_4.png?resize=1536%2C796&amp;ssl=1 1536w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can stop here if you want, but there\u2019s room for improvement\u2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-5-sculpting-the-flip-side\">Step 5: Sculpting the flip side<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To make the outcome look a bit more realistic, we\u2019ll use <code>corner-bottom-left-shape: bevel<\/code> to make one more straight cut, this time to <code>::before<\/code>. There are, most likely, many ways to tackle this depending on how sharply we want to crease the fold, how elevated we want the flip side to be, and the angle from which we want to view the square, but I don\u2019t think it matters as long as the effect looks decent, so we\u2019re aiming for a sharp crease, the flip side sticking up, and an aerial view. If you\u2019d rather something different, keep in mind that the shadow also impacts the outcome, and that you\u2019d be facing a trickier implementation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The only degree of complexity that I suggest is this:<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">\/* Ensure realistic fold *\/\n@container style(--x-coord &lt; --y-coord) {\n  border-bottom-left-radius: 100% calc(100% - var(--x-coord));\n}\n\n@container style(--x-coord >= --y-coord) {\n  border-bottom-left-radius: calc(100% - var(--y-coord)) 100%;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These are <a href=\"https:\/\/css-tricks.com\/the-range-syntax-has-come-to-container-style-queries-and-if\/\">container style queries using the range syntax<\/a>, where if the value of <code>--x-coord<\/code> is less than the value of <code>--y-coord<\/code>, we subtract the value of <code>--x-coord<\/code> from <code>100%<\/code> and use it as the y-axis coordinate for the relevant border radius (<code>border-bottom-left-radius<\/code>, in this case). The other axis is set to <code>100%<\/code>. Adversely, if the value of <code>--x-coord<\/code> is <em>more<\/em> than (or equal to) the value of <code>--y-coord<\/code>, we subtract the value of <code>--y-coord<\/code> from <code>100%<\/code> and use it as the x-axis coordinate. Once again, the other axis is set to <code>100%<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The result is that the crease, shadow, and now <em>perspective<\/em> of the fold is calculated using only <code>--x-coord<\/code> and <code>--y-coord<\/code> to look realistic (or realistic enough, anyway). Using the <a href=\"https:\/\/css-tricks.com\/playing-with-codepen-slidevars\/\">slideVars<\/a> toggles in the top-right corner of the demo, you can see for yourself by testing various combinations of coordinates:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_EagyxrX\" src=\"\/\/codepen.io\/anon\/embed\/EagyxrX?height=450&amp;theme-id=1&amp;slug-hash=EagyxrX&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed EagyxrX\" title=\"CodePen Embed EagyxrX\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"916\" style=\"aspect-ratio: 1768 \/ 916;\" width=\"1768\" controls src=\"https:\/\/css-tricks.com\/wp-content\/uploads\/2026\/04\/corner-shape-fold-5-1.mp4\" playsinline><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to implement a failsafe to ensure that the coordinates don\u2019t exceed the dimensions of the square, breaking the effect, you can use <a href=\"https:\/\/css-tricks.com\/almanac\/functions\/m\/min\/\"><code>min()<\/code><\/a>. The modified coordinate variables below set <code>--y-coord<\/code> to an impossible <code>999999999rem<\/code>, but caps it at the height of the square (although I can\u2019t imagine that you\u2019d actually need this, to be completely honest):<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">--x-coord: min(--square-width, 9rem);\n--y-coord: min(--square-height, 999999999rem);<\/code><\/pre>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_VYKGYWY\" src=\"\/\/codepen.io\/anon\/embed\/VYKGYWY?height=450&amp;theme-id=1&amp;slug-hash=VYKGYWY&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed VYKGYWY\" title=\"CodePen Embed VYKGYWY\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1768\" height=\"916\" src=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=1768%2C916&#038;ssl=1\" alt=\"White paper with the top-right corner folded in.\" class=\"wp-image-393432\" srcset=\"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?w=1768&amp;ssl=1 1768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=1024%2C531&amp;ssl=1 1024w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=768%2C398&amp;ssl=1 768w, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?resize=1536%2C796&amp;ssl=1 1536w\" sizes=\"auto, (min-width: 735px) 864px, 96vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">All in all, we have not only a folded corner effect but a utility that builds the effect based on only two coordinates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The full code:<\/p>\n\n\n\n<pre rel=\"CSS\" class=\"wp-block-csstricks-code-block language-css\" data-line=\"\"><code markup=\"tt\">:root {\n  \/* x-axis coordinate *\/\n  --x-coord: 9rem;\n\n  \/* y-axis coordinate *\/\n  --y-coord: 5rem;\n\n  \/* Square *\/\n  div {\n    \/* Place coordinates *\/\n    border-top-right-radius: var(--x-coord) var(--y-coord);\n\n    \/* Draw line between coordinates *\/\n    corner-top-right-shape: bevel;\n\n    \/* Clip any overflow *\/\n    overflow: clip;\n\n    \/* For alignment *\/\n    position: relative;\n\n    \/* Flip side *\/\n    &amp;::before {\n      \/* Generate empty element *\/\n      content: \"\";\n\n      \/* Inherit background *\/\n      background: inherit;\n\n      \/* Same as coordinates *\/\n      width: var(--x-coord);\n      height: var(--y-coord);\n\n      \/* Scale blur radius with --x-coord and --y-coord *\/\n      box-shadow: 0 0 calc((var(--x-coord) + var(--y-coord)) \/ 3) #00000050;\n\n      \/* For alignment *\/\n      position: absolute;\n\n      \/* Align to top-right *\/\n      inset: 0 0 auto auto;\n\n      \/* Draw line between coordinates *\/\n      corner-bottom-left-shape: bevel;\n\n      \/* Ensure realistic fold *\/\n      @container style(--x-coord &lt; --y-coord) {\n        border-bottom-left-radius: 100% calc(100% - var(--x-coord));\n      }\n\n      @container style(--x-coord >= --y-coord) {\n        border-bottom-left-radius: calc(100% - var(--y-coord)) 100%;\n      }\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"is-style-explanation wp-block-paragraph\"><strong>Note:<\/strong> We could <a href=\"https:\/\/css-tricks.com\/the-range-syntax-has-come-to-container-style-queries-and-if\/\">swap container style queries for <code>if()<\/code> functions<\/a>, which are shorter but less readable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"folded-corners-using-clip-path-vs-corner-shape-\">Folded corners using <code>clip-path<\/code> vs. <code>corner-shape<\/code><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/codepen.io\/KittyGiraudel\/pen\/raNoZLr\" rel=\"noopener\">Kitty\u2019s Giraudel\u2019s folded corners<\/a> work in all browsers, and because <code>clip-path<\/code> is used, which is a more versatile shaping feature, there are more ways to customize the shape. It\u2019s also the more correct approach, for whatever that\u2019s worth. However, my <code>corner-shape<\/code> approach is cleaner and likely wouldn\u2019t require any further customization anyway, but lacks Safari and Firefox support for now. So unless you need folded corners today, I\u2019d bookmark both:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/codepen.io\/KittyGiraudel\/pen\/raNoZLr\" rel=\"noopener\">Folded corners using CSS <code>clip-path<\/code><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/codepen.io\/mrdanielschwarz\/pen\/EagyxrX\" rel=\"noopener\">Folded corners using CSS <code>corner-shape<\/code><\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I came across Kitty Giraudel\u2019s folded corners technique. I\u2019ve been on a bit of a <code>corner-shape<\/code> kick lately, so I figured that <code>corner-shape<\/code> could be used to create folded corners as well.<\/p>\n","protected":false},"author":288677,"featured_media":393432,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[794,19123,862],"class_list":["post-393431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","tag-border","tag-corner-shape","tag-shapes"],"acf":{"show_toc":"Yes"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/04\/s_4309AEC000A3E54B3EAE7D9665BB7D541E09DE1556E769AE721013146BE52BD2_1775704329444_6.png?fit=1768%2C916&ssl=1","jetpack-related-posts":[{"id":389060,"url":"https:\/\/css-tricks.com\/what-can-we-actually-do-with-corner-shape\/","url_meta":{"origin":393431,"position":0},"title":"What Can We Actually Do With corner-shape?","author":"Daniel Schwarz","date":"September 12, 2025","format":false,"excerpt":"When I first started messing around with code, rounded corners required five background images or an image sprite likely created in Photoshop, so when border-radius came onto the scene, I remember everybody thinking that it was the best thing ever. Web designs were very square at the time, so to\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/09\/s_B9520AAEB8E72143A2990CEB07209D80D9AD692AC1F43B71E4BC9C84D7184887_1757081374239_Screenshot2025-09-05at8.08.39AM.png?fit=1200%2C660&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/09\/s_B9520AAEB8E72143A2990CEB07209D80D9AD692AC1F43B71E4BC9C84D7184887_1757081374239_Screenshot2025-09-05at8.08.39AM.png?fit=1200%2C660&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/09\/s_B9520AAEB8E72143A2990CEB07209D80D9AD692AC1F43B71E4BC9C84D7184887_1757081374239_Screenshot2025-09-05at8.08.39AM.png?fit=1200%2C660&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/09\/s_B9520AAEB8E72143A2990CEB07209D80D9AD692AC1F43B71E4BC9C84D7184887_1757081374239_Screenshot2025-09-05at8.08.39AM.png?fit=1200%2C660&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/09\/s_B9520AAEB8E72143A2990CEB07209D80D9AD692AC1F43B71E4BC9C84D7184887_1757081374239_Screenshot2025-09-05at8.08.39AM.png?fit=1200%2C660&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":386876,"url":"https:\/\/css-tricks.com\/better-css-shapes-using-shape-part-3-curves\/","url_meta":{"origin":393431,"position":1},"title":"Better CSS Shapes Using shape() \u2014 Part 3: Curves","author":"Temani Afif","date":"June 6, 2025","format":false,"excerpt":"This is the third article in a series about the CSS shape() function. We've covered drawing lines and arcs in previous articles and, this time, we look specifically at the curve command and how to use it for drawing complex shapes.","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"Diagrammiong a rounded rectangular shape in three stages, first with sharp edges, then with points indicating where the curve control points are, then the completed shape.","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/05\/css-shape-curve-diagram.webp?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/05\/css-shape-curve-diagram.webp?fit=1200%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/05\/css-shape-curve-diagram.webp?fit=1200%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/05\/css-shape-curve-diagram.webp?fit=1200%2C600&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2025\/05\/css-shape-curve-diagram.webp?fit=1200%2C600&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":364279,"url":"https:\/\/css-tricks.com\/cut-corners-using-css-mask-and-clip-path-properties\/","url_meta":{"origin":393431,"position":2},"title":"Tricks to Cut Corners Using CSS Mask and Clip-Path Properties","author":"Temani Afif","date":"March 30, 2022","format":false,"excerpt":"We recently covered creating fancy borders with CSS mask properties, and now we are going to cut the corners with CSS mask and clip-path! A lot of techniques exist to cut different shapes from the corners of any element. In this article, we will consider modern techniques to create unique\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/cutting-corners-1.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/cutting-corners-1.jpg?fit=1200%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/cutting-corners-1.jpg?fit=1200%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/cutting-corners-1.jpg?fit=1200%2C600&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/02\/cutting-corners-1.jpg?fit=1200%2C600&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":392503,"url":"https:\/\/css-tricks.com\/experimenting-with-scroll-driven-corner-shape-animations\/","url_meta":{"origin":393431,"position":3},"title":"Experimenting With Scroll-Driven corner-shape Animations","author":"Daniel Schwarz","date":"March 23, 2026","format":false,"excerpt":"The new CSS corner-shape() property is mathematical, so it\u2019s easily animated. Author Daniel Schwarz pokes at animating the property for interesting UI effects.","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/corner-shape-animation.webp?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/corner-shape-animation.webp?fit=1200%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/corner-shape-animation.webp?fit=1200%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/corner-shape-animation.webp?fit=1200%2C600&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/02\/corner-shape-animation.webp?fit=1200%2C600&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":393021,"url":"https:\/\/css-tricks.com\/whats-important-7\/","url_meta":{"origin":393431,"position":4},"title":"What\u2019s !important #7: random(), Folded Corners, Anchored Container Queries, and More","author":"Daniel Schwarz","date":"March 16, 2026","format":false,"excerpt":"For this issue we have random(), folded clip-path corners, anchored container queries, customizable select, scroll-triggered animations, and more.","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/03\/wi7.png?fit=1200%2C820&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/03\/wi7.png?fit=1200%2C820&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/03\/wi7.png?fit=1200%2C820&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/03\/wi7.png?fit=1200%2C820&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2026\/03\/wi7.png?fit=1200%2C820&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":353391,"url":"https:\/\/css-tricks.com\/exploring-the-css-paint-api-rounding-shapes\/","url_meta":{"origin":393431,"position":5},"title":"Exploring the CSS Paint API: Rounding Shapes","author":"Temani Afif","date":"October 22, 2021","format":false,"excerpt":"Adding borders to complex shapes is a pain, but rounding the corner of complex shapes is a nightmare! Luckily, the CSS Paint API is here to the rescue! That\u2019s what we\u2019re going to look at as part of this \u201cExploring the CSS Paint API\u201d series. Exploring the CSS Paint API\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/css-tricks.com\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/10\/header-rounding-shapes.png?fit=1031%2C465&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/10\/header-rounding-shapes.png?fit=1031%2C465&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/10\/header-rounding-shapes.png?fit=1031%2C465&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/10\/header-rounding-shapes.png?fit=1031%2C465&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/393431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/288677"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=393431"}],"version-history":[{"count":5,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/393431\/revisions"}],"predecessor-version":[{"id":394702,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/393431\/revisions\/394702"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/393432"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=393431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=393431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=393431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}