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

Make a Hexagon in CSS

If you want to make a hexagon in CSS first set up your div. We are going to give our div an id of hexagon.

<div id="hexagon"></div>

Next we will style the div with css.

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂
<style>
#hexagon {
width: 100px;
height: 55px;
background: brown;
position: relative;
}
#hexagon:before {
content: "";
position: absolute;
top: -25px;
left: 0;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 25px solid brown;
}
#hexagon:after {
content: "";
position: absolute;
bottom: -25px;
left: 0;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 25px solid brown;
}
</style>

Make a Hexagon in CSS

When we see the code in action we can start taking away from the code to see how each part works. This is a good way to learn how to edit and Make a Hexagon in CSS!

Make a Hexagon in CSS was last modified: May 22nd, 2015 by Maximus Mccullough

Subscribe To My YouTube Channel:

Please like, share and subscribe.

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

Cool People Share:
create-a-hexagon-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.