Graphic Design Web Design SEO Web Development HTML & CSS JavaScript WordPress Eleventy Innovation Portfolio My YouTube Channel Speedlify Presenting Multi Grid Navigation Sounds Affordable & Reliable Golden Ratio Optimizations X-height

Make Custom Shapes with SVG Polygon

By: on Dec 18, 2022

Make custom shapes that are responsive and work good as backgrounds with SVG's. The SVG polygon element uses x and y coordinates, so it's easy to make basic SVG shapes without software. Well you will need a code editor of your choice of course.

To make the shape responsive set the viewBox="x y width height" to the width and height that the polygon will be. This shape will be responsive as long as it is set as the same width as the polygon.

There are five polygon points that start at the top left, top right, bottom right, bottom left and back to the top left.

<svg viewBox="0 0 1200 300" xmlns="">
<polygon points="0 0, 1200 0, 1200 300, 0 180, 0 0" fill="grey" />


To make combinations of shapes we can add more polygons elements.

<svg viewBox="0 0 1200 300" xmlns="">
<polygon points="0 50, 1200 0, 1200 60, 0 60, 0 50" fill="grey" />
<polygon points="0 60, 1200 60, 1200 300, 0 180, 0 0" fill="darkgrey" />


Making custom shapes with SVG's can be easier than making shapes with CSS. Although polygon and polyline elements are always rendered as a sequence of straight line segments between the coordinates you provide. So there is no way to automatically make the corners have a radius, like an CSS border-radius.

What we can do is use the CSS stroke property to create the rounded corners effect. We also have to keep in mind the SVG viewBox to account for the the added stroke-width.

.round {
stroke: grey;
stroke-width: 20;
stroke-linejoin: round;
<svg viewBox="0 0 1210 310" xmlns="">
<polygon class="round" points="10 10, 1200 10, 1200 300, 10 180, 10 10" fill="grey" />



Creating custom SVG shapes gives you a really light weight and responsive shape with nice crisp lines. If you have a more complex shape figma is great for vector graphics and will output an SVG using the path element. This will follow any path needed, but it's not as intuitive to manually customize like the polygon element.