Skip to main content
Timonwa Studio
All projectsCSS art · 2021 · Complete

Shapes with CSS

Twenty-six shapes in pure CSS, with the code for every shape to copy.

Shapes

26

Made with

Pure CSS

GitHub stars

1

What I set out to do

I built this alongside Letters with CSS in 2021, before AI tools, to practise the same four CSS techniques: pseudo-elements, borders and box-shadow, positioning, and transforms. Where the letters combined them into one letter after another, this project used them to get each shape right on its own, as simply as possible.

What I built

A gallery of 26 shapes, most drawn with a single HTML element and CSS alone. No images or SVG.

  • Circles and curves: circle, quarter and three-quarter circles, semicircles, oval, egg, and pill.
  • Triangles and polygons: three kinds of triangle, square, rectangle, parallelogram, trapezoids, rhombus, kite, pentagon, and pyramid.
  • Figures: star, crescent, horseshoe, plus sign, heart, and magnifying glass.

Each technique has its job. Borders with transparent sides make the triangles and trapezoids, border-radius makes the circles, oval, and egg, pseudo-elements add the extra pieces of the star and heart, and transforms rotate pieces into place. Two shapes are drawn twice on purpose, so you can compare techniques: the semicircle with border-radius against borders, and the trapezoid with borders against pseudo-elements.

On the live site, select any shape to see it large, with its HTML and CSS ready to copy, and its own link to share.

Who it's for

Anyone learning CSS, or who needs a simple shape without reaching for an image or an icon set. Copy a shape's HTML and CSS straight into your page, recolour it with one variable, and compare the shapes drawn two ways to see which technique suits you.

Where it is now

Complete. All 26 shapes are drawn, with the code for each one on the live site, shown below.

Live demoshapes-with-css.vercel.appOpen (opens in a new tab)