transform rotate a hexagon in css

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

HTML

<h2>example hexagon</h2>
<div class="hexagon"></div>

CSS

.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;
}
.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;
}

example hexagon

External Link for transform rotate a hexagon in css

Other Items in css
Page Views

This page has been viewed 385 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.

❤👩‍💻🕹

Random Quote
I believe that success can be measured in the number of uncomfortable conversations you're willing to have.
Unknown