Make a Pentagon in CSS. Set up a div in your html page and call it pentagon.
<div id="pentagon"></div>
Next we will style the div in our CSS to create the pentagon.
<style>
#pentagon {
position: relative;
width: 54px;
border-width: 50px 18px 0;
border-style: solid;
border-color: pink transparent;
}
#pentagon:before {
content: "";
position: absolute;
height: 0;
width: 0;
top: -85px;
left: -18px;
border-width: 0 45px 35px;
border-style: solid;
border-color: transparent transparent pink;
}
</style>

Make a Pentagon in CSS

Tear apart this CSS code piece by piece and you will learn better how to Make a Pentagon in CSS. Most coders learn this way in order to understand the syntax better.

Sign Up To Comment