{"id":6235,"date":"2025-06-18T12:05:26","date_gmt":"2025-06-18T17:05:26","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=6235"},"modified":"2025-06-18T20:39:31","modified_gmt":"2025-06-19T01:39:31","slug":"drawing-css-shapes-using-corner-shape","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/drawing-css-shapes-using-corner-shape\/","title":{"rendered":"Drawing CSS Shapes using corner-shape"},"content":{"rendered":"\n<p>We recently got <a href=\"https:\/\/frontendmasters.com\/blog\/tag\/shape\/\">the new\u00a0<code>shape()<\/code>\u00a0function<\/a> for\u00a0<code>clip-path<\/code>\u00a0which is a game changer for creating CSS shape. Another cool feature is on the way and will soon be available: <code>corner-shape<\/code>.<\/p>\n\n\n\n<p>I will not call it \u201cnew\u201d because it\u2019s something that has been around for quite a while and you can find countless GitHub discussions around it. There is even&nbsp;<a href=\"https:\/\/github.com\/LeaVerou\/corner-shape\">an 11-year old Github Repo made by Lea Verou<\/a>&nbsp;with an interactive demo showing a few examples! After all that time, It finally has&nbsp;<a href=\"https:\/\/drafts.csswg.org\/css-borders-4\/#corner-shaping\">its own specification<\/a>&nbsp;and is ready to be implemented and shipped.<\/p>\n\n\n\n<p class=\"learn-more\">At the time of writing, <code>corner-shape<\/code> is <a href=\"https:\/\/chromestatus.com\/feature\/5357329815699456\">available in Chrome v139<\/a> or 136+ with the experimental web features flag turned on, but no other browsers yet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-corner-shape\">What is corner-shape?<\/h2>\n\n\n\n<p>When you define a&nbsp;<code>border-radius<\/code>&nbsp;you will get rounded corners.&nbsp;<code>corner-shape<\/code>&nbsp;allows you to change those rounded corners to something else. It\u2019s in the name; it changes the \u201cshape\u201d of the \u201ccorner\u201d.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"890\" height=\"195\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/IqSM2bQw.png?resize=890%2C195&#038;ssl=1\" alt=\"A graphic displaying different CSS corner shapes: 'round', 'scoop', 'bevel', 'notch', and 'squircle', each in a purple background with white text.\" class=\"wp-image-6236\" style=\"width:635px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/IqSM2bQw.png?w=890&amp;ssl=1 890w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/IqSM2bQw.png?resize=300%2C66&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/IqSM2bQw.png?resize=768%2C168&amp;ssl=1 768w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><\/figure>\n<\/div>\n\n\n<p>The value <code>round<\/code>&nbsp;is the default (the classic rounded corners). As you can see above, we have many cool variations. All of this with a simple syntax:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.corner<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">30px<\/span>;\n  <span class=\"hljs-attribute\">corner-shape<\/span>: round | scoop | bevel | notch | squircle;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>We can also use the&nbsp;<code>superellipse(K)<\/code>&nbsp;value that can define all the different variations and more by adjusting the&nbsp;<code>K<\/code>&nbsp;variable. I will not detail that part as it\u2019s not important for the article but it\u2019s good to know so I invite you to check&nbsp;<a href=\"https:\/\/drafts.csswg.org\/css-borders-4\/#corner-shaping\">the (draft) specification<\/a>&nbsp;for more detail.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"501\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6tnTLi91.png?resize=777%2C501&#038;ssl=1\" alt=\"Diagram illustrating various 'superellipse()' values for corner shapes with labeled corners and arrows indicating direction. Shows how the corner shape changes with different K values.\" class=\"wp-image-6238\" style=\"width:561px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6tnTLi91.png?w=777&amp;ssl=1 777w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6tnTLi91.png?resize=300%2C193&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6tnTLi91.png?resize=768%2C495&amp;ssl=1 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"lets-draw-some-shapes\">Let\u2019s Draw Shapes<\/h2>\n\n\n\n<p>Changing the corner shape is good \u2014 but how can we draw <em>shapes<\/em>? The answer is to play with&nbsp;<code>border-radius<\/code>. Follow along to see all the magic we can do with&nbsp;<code>corner-shape<\/code>!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"rhombus--octagon\">Rhombus &amp; Octagon<\/h3>\n\n\n\n<p>If you look closely at the example using the&nbsp;<code>bevel<\/code>&nbsp;value, you will see that we have 8 sides since the corners are diagonal straight lines so we almost have an octagon shape. We simply need to find the exact value for&nbsp;<code>border-radius<\/code>&nbsp;that gives us 8 equal sides.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"348\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/ZeCHx_ws.png?resize=793%2C348&#038;ssl=1\" alt=\"\" class=\"wp-image-6239\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/ZeCHx_ws.png?w=793&amp;ssl=1 793w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/ZeCHx_ws.png?resize=300%2C132&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/ZeCHx_ws.png?resize=768%2C337&amp;ssl=1 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/figure>\n\n\n\n<p>I will skip the boring math and give you the final value which is:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">border-radius<\/span>: <span class=\"hljs-selector-tag\">calc<\/span>(100%\/(2 + <span class=\"hljs-selector-tag\">sqrt<\/span>(2)));<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Even without being precise, you can approximate the value using trial &amp; error. You will get an octagon when you are close to&nbsp;<code>29%<\/code>. The usage of percentage is important because it means the shape is responsive and let\u2019s not forget&nbsp;<code>aspect-ratio: 1<\/code>&nbsp;as well.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.octagon<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-built_in\">calc<\/span>(<span class=\"hljs-number\">100%<\/span>\/(<span class=\"hljs-number\">2<\/span> + sqrt(<span class=\"hljs-number\">2<\/span>)));\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n  <span class=\"hljs-attribute\">aspect-ratio<\/span>: <span class=\"hljs-number\">1<\/span>;\n} <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Now what if we keep increasing the radius? We get a Rhombus shape at&nbsp;<code>50%<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"845\" height=\"344\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/RtLO8vP1.png?resize=845%2C344&#038;ssl=1\" alt=\"\" class=\"wp-image-6241\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/RtLO8vP1.png?w=845&amp;ssl=1 845w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/RtLO8vP1.png?resize=300%2C122&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/RtLO8vP1.png?resize=768%2C313&amp;ssl=1 768w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><\/figure>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.rhombus<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">50%<\/span>;\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n  <span class=\"hljs-attribute\">aspect-ratio<\/span>: <span class=\"hljs-number\">1<\/span>;\n} <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_OPVZwxg\/c3238283c33ef694eec5bb1694f06957\" src=\"\/\/codepen.io\/anon\/embed\/preview\/OPVZwxg\/c3238283c33ef694eec5bb1694f06957?height=450&amp;theme-id=47434&amp;slug-hash=OPVZwxg\/c3238283c33ef694eec5bb1694f06957&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed OPVZwxg\/c3238283c33ef694eec5bb1694f06957\" title=\"CodePen Embed OPVZwxg\/c3238283c33ef694eec5bb1694f06957\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>Some of you might ask if this method is better than what we already have. In&nbsp;<a href=\"https:\/\/css-shape.com\/\">my shape collection<\/a>, you can easily find the code of the above shapes made using&nbsp;<code>clip-path<\/code>&nbsp;so why another method?<\/p>\n\n\n\n<p>First of all, the syntax is a bit easier than the&nbsp;<code>clip-path<\/code>&nbsp;one so this can improve the readability of the code as we have fewer values to deal with. But the most important advantage is that we can add a border to the shape! Adding borders to custom shapes is always a nightmare but&nbsp;<code>corner-shape<\/code>&nbsp;made it easy.<\/p>\n\n\n\n<p>This is logical since, by default, when we add&nbsp;<code>border-radius<\/code>, the border and other decorations such as&nbsp;<code>box-shadow<\/code>&nbsp;will follow the rounded corners. It\u2019s still the case even if we change the shape of the corner.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"200\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/q8rLnLOp.png?resize=905%2C200&#038;ssl=1\" alt=\"Five shapes with different corner styles labeled: round, scoop, bevel, notch, and squircle, all displayed on a purple background.\" class=\"wp-image-6242\" style=\"width:694px;height:auto\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/q8rLnLOp.png?w=905&amp;ssl=1 905w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/q8rLnLOp.png?resize=300%2C66&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/q8rLnLOp.png?resize=768%2C170&amp;ssl=1 768w\" sizes=\"auto, (max-width: 905px) 100vw, 905px\" \/><\/figure>\n<\/div>\n\n\n<p>Here are the rhombus and octagon shapes with borders:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_PwqevXP\/fe459c812b5e4360385c7a67f988e714\" src=\"\/\/codepen.io\/anon\/embed\/preview\/PwqevXP\/fe459c812b5e4360385c7a67f988e714?height=450&amp;theme-id=47434&amp;slug-hash=PwqevXP\/fe459c812b5e4360385c7a67f988e714&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed PwqevXP\/fe459c812b5e4360385c7a67f988e714\" title=\"CodePen Embed PwqevXP\/fe459c812b5e4360385c7a67f988e714\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>Note how we can have a border-only version if we keep the background transparent and we can also apply the shape to an image as well. Cool, right?<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"hexagon\">Hexagon<\/h3>\n\n\n\n<p>Do you see how can we achieve a hexagon shape? Try to think about it before reading my explanation.<\/p>\n\n\n\n<p>The trick is to rely on the fact that&nbsp;<code>border-radius<\/code>&nbsp;accepts vertical and horizontal values, something we always forget about. Let\u2019s take the rhombus shape and decrease the vertical or the horizontal radius.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"737\" height=\"502\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6nJJ3x5a.png?resize=737%2C502&#038;ssl=1\" alt=\"\" class=\"wp-image-6243\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6nJJ3x5a.png?w=737&amp;ssl=1 737w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/6nJJ3x5a.png?resize=300%2C204&amp;ssl=1 300w\" sizes=\"auto, (max-width: 737px) 100vw, 737px\" \/><\/figure>\n\n\n\n<p>Do you see that? We have an \u201calmost\u201d hexagon shape. All that is missing is the correct <code>aspect-ratio<\/code>.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.hexagon<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">50%<\/span> \/ <span class=\"hljs-number\">25%<\/span>; <span class=\"hljs-comment\">\/* OR 25% \/ 50% *\/<\/span>\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n  <span class=\"hljs-attribute\">aspect-ratio<\/span>: <span class=\"hljs-built_in\">cos<\/span>(<span class=\"hljs-number\">30deg<\/span>); <span class=\"hljs-comment\">\/* OR 1\/cos(30deg) *\/<\/span>\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>We can definitely say that we have&nbsp;<a href=\"https:\/\/css-tip.com\/hexagon\/\">the easiest and simplest way to create hexagon shapes<\/a>!<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_yyNjgzR\" src=\"\/\/codepen.io\/anon\/embed\/preview\/yyNjgzR?height=450&amp;theme-id=47434&amp;slug-hash=yyNjgzR&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed yyNjgzR\" title=\"CodePen Embed yyNjgzR\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"triangles\">Triangles<\/h3>\n\n\n\n<p>Following the same logic we can create most of the common shapes and triangles aren\u2019t an exception. Again, we can use the Rhombus as a starting point and adjust either the horizontal or the vertical radius like below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"343\" src=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/1rHsNa2J.png?resize=771%2C343&#038;ssl=1\" alt=\"\" class=\"wp-image-6244\" srcset=\"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/1rHsNa2J.png?w=771&amp;ssl=1 771w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/1rHsNa2J.png?resize=300%2C133&amp;ssl=1 300w, https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/1rHsNa2J.png?resize=768%2C342&amp;ssl=1 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/figure>\n\n\n\n<p>This one can be a bit tricky at first glance because we don\u2019t have the 4 diagonal lines for each corner like the previous shapes but don\u2019t forget that we can use&nbsp;<code>0<\/code>&nbsp;with&nbsp;<code>border-radius<\/code>&nbsp;which will disable the corresponding corner.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.triangle<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">50%<\/span> \/ <span class=\"hljs-number\">100%<\/span> <span class=\"hljs-number\">100%<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span>; \n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n} <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>From there, we can easily get any kind of triangle by trying the different radius combinations and also playing with&nbsp;<code>aspect-ratio<\/code>.<\/p>\n\n\n\n<p>Below is a demo with many examples. Try to create some of them before checking my code. It\u2019s the perfect exercise to practice with corner-shape.<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_yyNjmLw\/f23dc1d6e85e75aab32980fb56e46e1d\" src=\"\/\/codepen.io\/anon\/embed\/preview\/yyNjmLw\/f23dc1d6e85e75aab32980fb56e46e1d?height=450&amp;theme-id=47434&amp;slug-hash=yyNjmLw\/f23dc1d6e85e75aab32980fb56e46e1d&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed yyNjmLw\/f23dc1d6e85e75aab32980fb56e46e1d\" title=\"CodePen Embed yyNjmLw\/f23dc1d6e85e75aab32980fb56e46e1d\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>The only caveat with triangle shapes is that the border is not perfect. It may sound like a bug but it\u2019s not. I won\u2019t detail the logic behind this but if you want to add a border, you may need a different thickness for one or many sides.<\/p>\n\n\n\n<p>Here is an example with one of the triangle shapes where I am increasing the thickness of the top border a little to have a perfect-looking shape.<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_LEVmwNb\/d6def555e08b2c6f5d250f36f2c35895\" src=\"\/\/codepen.io\/anon\/embed\/preview\/LEVmwNb\/d6def555e08b2c6f5d250f36f2c35895?height=450&amp;theme-id=47434&amp;slug-hash=LEVmwNb\/d6def555e08b2c6f5d250f36f2c35895&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed LEVmwNb\/d6def555e08b2c6f5d250f36f2c35895\" title=\"CodePen Embed LEVmwNb\/d6def555e08b2c6f5d250f36f2c35895\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>As you can see in the code, there is a math formula to get the correct thickness but since it will be a different formula for each triangle shape, I won\u2019t bother you with a boring explanation. Plus you can easily (and rapidly) get a good result with some trial &amp; error. No need to be very precise.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"slanted-edge\">Slanted edge<\/h3>\n\n\n\n<p>All the shapes we created rely on percentage values but&nbsp;<code>border-radius<\/code>&nbsp;accepts length as well, which means we can have elements with variable size but the shape remains static.<\/p>\n\n\n\n<p>Example with a slanted edge where the slant keeps the same size whatever the element width:<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_VYLxoPW\/ca6f2ac59bceeb2e7849fd967434a4e2\" src=\"\/\/codepen.io\/anon\/embed\/preview\/VYLxoPW\/ca6f2ac59bceeb2e7849fd967434a4e2?height=450&amp;theme-id=47434&amp;slug-hash=VYLxoPW\/ca6f2ac59bceeb2e7849fd967434a4e2&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed VYLxoPW\/ca6f2ac59bceeb2e7849fd967434a4e2\" title=\"CodePen Embed VYLxoPW\/ca6f2ac59bceeb2e7849fd967434a4e2\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>The code is a simple as:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.slanted<\/span> {\n  <span class=\"hljs-attribute\">border-top-right-radius<\/span>: <span class=\"hljs-number\">80px<\/span> <span class=\"hljs-number\">100%<\/span>;\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>No need for the shorthand property in this case since only the top-right corner matters. As for the value, I think it\u2019s self-explanatory. Simply notice that there is no&nbsp;<code>\/<\/code>&nbsp;to separate the horizontal and vertical radius when using the longhand properties.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"arrow-like-box\">Arrow-like box<\/h3>\n\n\n\n<p>Using the same logic we can have an arrow-like box:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.arrow<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">80px<\/span> \/ <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">50%<\/span> <span class=\"hljs-number\">50%<\/span> <span class=\"hljs-number\">0<\/span>;\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_vEOjoWp\/d4c40a4df915fedb72589ce12679241d\" src=\"\/\/codepen.io\/anon\/embed\/preview\/vEOjoWp\/d4c40a4df915fedb72589ce12679241d?height=450&amp;theme-id=47434&amp;slug-hash=vEOjoWp\/d4c40a4df915fedb72589ce12679241d&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed vEOjoWp\/d4c40a4df915fedb72589ce12679241d\" title=\"CodePen Embed vEOjoWp\/d4c40a4df915fedb72589ce12679241d\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"trapezoid--parallelogram\">Trapezoid &amp; Parallelogram<\/h3>\n\n\n\n<p>Also trapezoid &amp; parallelogram shapes:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-class\">.trapezoid<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">80px<\/span> \/ <span class=\"hljs-number\">100%<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">100%<\/span> <span class=\"hljs-number\">0<\/span>;\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n}\n<span class=\"hljs-selector-class\">.parallelogram<\/span> {\n  <span class=\"hljs-attribute\">border-radius<\/span>: <span class=\"hljs-number\">80px<\/span> \/ <span class=\"hljs-number\">100%<\/span> <span class=\"hljs-number\">100%<\/span> <span class=\"hljs-number\">0<\/span> <span class=\"hljs-number\">0<\/span>;\n  <span class=\"hljs-attribute\">corner-shape<\/span>: bevel;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_WbvJVdW\/6f457e77e3329e33243284392a40c18a\" src=\"\/\/codepen.io\/anon\/embed\/preview\/WbvJVdW\/6f457e77e3329e33243284392a40c18a?height=450&amp;theme-id=47434&amp;slug-hash=WbvJVdW\/6f457e77e3329e33243284392a40c18a&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed WbvJVdW\/6f457e77e3329e33243284392a40c18a\" title=\"CodePen Embed WbvJVdW\/6f457e77e3329e33243284392a40c18a\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Using only the&nbsp;<code>bevel<\/code>&nbsp;option of&nbsp;<code>corner-shape<\/code>&nbsp;we were able to create a lot of different shapes easily. All we had to do was to play with&nbsp;<code>border-radius<\/code>, a well-known property. Not to mention the fact that we can easily add borders and box shadows which is a real game changer compared to shapes created using&nbsp;<code>clip-path<\/code>&nbsp;or&nbsp;<code>mask<\/code>.<\/p>\n\n\n\n<p>I will end the article with a last demo where I combine&nbsp;<code>bevel<\/code>&nbsp;and&nbsp;<code>notch<\/code>&nbsp;to create an arrow. Yes, you can have a different shape per corner!<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_WbvyNMM\/c9c9d97340eb6762b8b2230bbf7d00dc\" src=\"\/\/codepen.io\/anon\/embed\/preview\/WbvyNMM\/c9c9d97340eb6762b8b2230bbf7d00dc?height=450&amp;theme-id=47434&amp;slug-hash=WbvyNMM\/c9c9d97340eb6762b8b2230bbf7d00dc&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed WbvyNMM\/c9c9d97340eb6762b8b2230bbf7d00dc\" title=\"CodePen Embed WbvyNMM\/c9c9d97340eb6762b8b2230bbf7d00dc\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p>What about you? Can you think about a cool shape using&nbsp;<code>corner-shape<\/code>?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After you&#8217;ve got a `border-radius`, you can control the shape of the corner with `corner-shape`, which unlocks a simpler and more powerful way to make shapes compared to `clip-path()`.<\/p>\n","protected":false},"author":12,"featured_media":6263,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[42,355,118],"class_list":["post-6235","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-post","tag-border-radius","tag-corner-shape","tag-shapes"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/06\/Drawing-CSS-Shapes-using-corner-shape.jpg?fit=1140%2C676&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/6235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=6235"}],"version-history":[{"count":7,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/6235\/revisions"}],"predecessor-version":[{"id":6269,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/6235\/revisions\/6269"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/6263"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=6235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=6235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=6235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}