JSFiddle - React, Tailwind, and code Playground
by Justin
HTML
<a href="http://www.lelabuttery.com/chef/" class="chef">
<div class="hexagon"><div>Chef</div></div>
<div class="underline"></div>
</a>
<a href="http://www.lelabuttery.com/teacher/" class="teacher">
<div class="hexagon"><div>Teacher</div></div>
<div class="underline"></div>
</a>
<a href="http://www.lelabuttery.com/adventurer/" class="adventurer">
<div class="hexagon"><div>Adventurer</div></div>
<div class="underline"></div>
</a>
<a href="http://www.lelabuttery.com/biologist/" class="biologist">
<div class="hexagon"><div>Biologist</div></div>
<div class="underline"></div>
</a>
CSS
.hexagon {
position: relative;
width: 100px;
height: 46px;
background-color: #64C7CC;
margin: 20px;
}
.hexagon > div {
line-height: 46px;
}
.hexagon:before, .hexagon:after {
content:"";
position: absolute;
width: 0;
border-left: 23px solid transparent;
border-right: 23px solid transparent;
}
.hexagon:before {
left: -37%;
bottom: 20%;
border-bottom: 28.87px solid #64C7CC;
transform: rotate(270deg);
}
.hexagon:after {
left: 91%;
bottom: 19%;
width: 0;
border-top: 28.87px solid #64C7CC;
transform: rotate(270deg);
}
.chef > div {
color: #525252;
background-color: #FADC53;
}
.chef: hover > div {
color: #FFF;
}
.chef div:before {
border-bottom: 28.87px solid #FADC53;
}
.chef div:after {
border-top: 28.87px solid #FADC53;
}
.adventurer > div {
color: #FFF;
background-color: #6F6D71;
}
.adventurer:hover > div {
color: #525252;
}
.adventurer > div:before {
border-bottom: 28.87px solid #6F6D71;
}
.adventurer > div:after {
border-top: 28.87px solid #6F6D71;
}
.teacher > div {
color: #525252;
background-color: #39D8B2;
}
.teacher > div:before {
border-bottom: 28.87px solid #39D8B2;
}
.teacher > div:after {
border-top: 28.87px solid #39D8B2;
}
.teacher: hover > div {
color: #FFF;
}
.biologist > div {
color: #FFF;
background-color: #E0BE47;
}
.biologist: hover > div {
color: #525252;
}
.biologist > div:before {
border-bottom: 28.87px solid #E0BE47;
}
.biologist > div:after {
border-top: 28.87px solid #E0BE47;
}
a:hover .underline {
display: block;
}
a {
cursor: pointer;
text-decoration: none;
text-align: center;
display: inline-block;
}
.underline {
height: 2px;
width: 102px;
margin-top: -15px;
margin-left: 20px;
display: none;
background-color: #FADC53;
}