Skip to content

Instantly share code, notes, and snippets.

@noximus
Last active April 3, 2019 16:13
Show Gist options
  • Save noximus/25292a82e1a373b7351a71726f40877d to your computer and use it in GitHub Desktop.
Save noximus/25292a82e1a373b7351a71726f40877d to your computer and use it in GitHub Desktop.
hex with bells and whistles
.hexagon {
position: relative;
width: 100px;
height: 57.74px;
background-color: #6a08ca;
margin: 28.87px 0;
box-shadow: 0 0 20px rgba(222,189,255,0.45);
border-left: solid 4px #333333;
border-right: solid 4px #333333;
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
z-index: 1;
width: 70.71px;
height: 70.71px;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background-color: inherit;
left: 10.6447px;
box-shadow: 0 0 20px rgba(222,189,255,0.45);
}
.hexagon:before {
top: -35.3553px;
border-top: solid 5.6569px #333333;
border-right: solid 5.6569px #333333;
}
.hexagon:after {
bottom: -35.3553px;
border-bottom: solid 5.6569px #333333;
border-left: solid 5.6569px #333333;
}
/*cover up extra shadows*/
.hexagon span {
display: block;
position: absolute;
top:2.3094010767585025px;
left: 0;
width:92px;
height:53.1162px;
z-index: 2;
background: inherit;
}
<div class="hexagon"><span>hello</span></div>
<!--http://brenna.github.io/csshexagon/-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment