Skip to main content

Command Palette

Search for a command to run...

How to create CSS Triangle

Published
•1 min read
How to create CSS Triangle
D

I am 17 years old and a young passionate and self-taught frontend web developer and have an intention to become a successful developer. I usually write about JavaScript and Web Development and share some tips in the articles.

In this article, I will show you the simple way to create a triangle with CSS.

Let's go!

To create a triangle first, create a div:

<div class="triangle"></div>

Now it's time to show some of the powers of CSS:

.triangle {
  width: 0;
  height: 0;
  border: 100px solid transparent;
  border-top: 0;
  border-bottom: 200px solid black;
}

image.png

You have made the triangle. 🎉

If you're interested in checking the live version, check out the following CodePen:

Thanks for reading

Follow me on Twitter

Thanks for reading!

42 views

More from this blog

D

Dhairya Shah

119 posts