transform rotate a hexagon in css

if you ever needed a hexagon in css here is how you can do it.

code

<style>
.hexagon {
  position: relative;
  width: 250px; 
  height: 144.34px;
  background-color: #64C7CC;
  margin: 72.17px auto;
  transform: rotate(30deg);
}

.hexagon:before,
.hexagon:after {
  content: "";
  position: absolute;
  width: 0;
  border-left: 125px solid transparent;
  border-right: 125px solid transparent;
}

.hexagon:before {
  bottom: 100%;
  border-bottom: 72.17px solid #64C7CC;
}

.hexagon:after {
  top: 100%;
  width: 0;
  border-top: 72.17px solid #64C7CC;
}
</style>
<div class="hexagon"></div>

example

links

csshexagon

Demo

Other Items in css
Page Views

This page has been viewed 208 times.

Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹