I am facing a challenge with a hexagon created using CSS. I want to place a header, paragraph, and button inside the hexagon, but they keep getting hidden behind the hexagon's before and after formatting. You can access the code through this link: https://jsfiddle.net/o8a3pm3h/6/ . Any suggestions on how to properly position these elements on the surface of the hexagon div would be greatly appreciated.
#hex3 {
width: 200px;
height: 200px;
}
#color3 {
background-color: #CED7DC;
}
.hexagon-wrapper {
text-align: center;
margin: 20px;
position: relative;
display: inline-block;
}
.hexagon {
height: 100%;
width: calc(100% * 0.57735);
display: inline-block;
z-index: 1;
}
.hexagon:before {
position: absolute;
top: 0;
right: calc((100% / 2) - ((100% * 0.57735) / 2));
background-color: inherit;
height: inherit;
width: inherit;
content: '';
transform: rotateZ(60deg);
}
.hexagon:after {
position: absolute;
top: 0;
right: calc((100% / 2) - ((100% * 0.57735) / 2));
background-color: inherit;
height: inherit;
width: inherit;
content: '';
transform: rotateZ(-60deg);
}
<!--Please maintain the styling here because its on top of an image-->
<div id="hex3" class="hexagon-wrapper" style="position:absolute; top:80px; right:400px;">
<div id="color3" class="hexagon">
<h4>TEST</h4>
<p>TESTTTTTTTTTT</p>
<button type="button" class="btn btn-secondary" id="grid-row-btn-2" onclick="location.href='/#/'">
DISCOVER MORE <span class="glyphicon glyphicon-chevron-right"></span>
</button>
</div>
</div>
**I understand that using inline CSS is generally discouraged, but it was necessary for this particular demonstration.