1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 5.00 out of 5)

Make a 5 point star in CSS

The first thing we will do is set up our div and we will call it star.

<div id="star"></div>

Next we will add the CSS to give us a purple star.

<style>
#star{
width: 0;
height: 0;
border-style: solid;
border-width: 0 100px 100px 100px;
border-color: transparent transparent purple transparent;
}
#star {
margin: 50px 0;
position: relative;
display: block;
color: purple;
width: 0px;
height: 0px;
border-right: 100px solid transparent;
border-bottom: 70px solid purple;
border-left: 100px solid transparent;
-moz-transform: rotate(35deg);
-webkit-transform: rotate(35deg);
-ms-transform: rotate(35deg);
-o-transform: rotate(35deg);
}
#star:before {
border-bottom: 80px solid purple;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
position: absolute;
height: 0;
width: 0;
top: -45px;
left: -65px;
display: block;
content: '';
-webkit-transform: rotate(-35deg);
-moz-transform: rotate(-35deg);
-ms-transform: rotate(-35deg);
-o-transform: rotate(-35deg);

}
#star:after {
position: absolute;
display: block;
color: purple;
top: 3px;
left: -105px;
width: 0px;
height: 0px;
border-right: 100px solid transparent;
border-bottom: 70px solid purple;
border-left: 100px solid transparent;
-webkit-transform: rotate(-70deg);
-moz-transform: rotate(-70deg);
-ms-transform: rotate(-70deg);
-o-transform: rotate(-70deg);
content: '';
}

</style>

 

Make a 5 point star in CSS *

The best way to figure out how to make a 5 point star in CSS is by working with an existing code. You can therefore subtract and add to that CSS code in order to understand it better. 🙂

Subscribe To My YouTube Channel:

To see more please visit CSS tricks  on star shapes.

Make a 5 point star in CSS was last modified: May 8th, 2015 by Maximus Mccullough

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips

Tips

create-a-star-with-css

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.