Have you ever seen a pure CSS website where each and every element is finished through CSS?

CSS does more than just styling elements.

CSS shapes allow web designers to create custom paths like a triangle, circles, polygons, and more.

Creating Basic and Advanced Shapes Using Pure CSS

Unsplash

In this article, well use CSS shapes and a few functional values to code different shapes.

Square and Rectangle

Square and rectangle are the easiest shapes to make in CSS.

All you better do is to create aand give it aheightand awidth.

Square and rectangle using CSS

Do the same with the rectangle to get an ellipse.

Triangles

Well use borders to create triangles.

Wondering how it works?

Creating circle and ellipse using CSS

All you oughta do is to set thewidthandheightof the triangle to zero.

It means, moving forward, theactual widthof the element will be thewidth of the border.

Also, you may already know that the border edges are 45-degrees diagonals to each other.

Drawing triangle using border property in CSS

Give different colors to each border and set any three of them to transparent.

Ultimately, youll have your triangle.

you might play around withheightandborder-colorto get different types of triangles.

Different triangles  using CSS

Pentagon

it’s possible for you to create a pentagon by combining a trapezoid and a triangle.

Useborderandposition propertiesshape and group them.

Diamond

Group two triangles pointing upwards and downwards using position to create a diamond shape.

Creating start using CSS

Yes, well use theborderproperties to create these triangles.

Ultimately, you might settransform-originto set the point around which the transformation is applied.

Building a super-fast website isnt a hectic task anymore as you know how to play around with the code.

Drawing pentagon using CSS

Therefore, keep experimenting and discover new ways to draw awesome shapes purely by CSS.

Diamond shape using CSS

Drawing diamond-shield using CSS

Drawing a heart shape using CSS