I have the following code for a hexagon. I need a border around the hexagon and an image as a background of the hexagon instead of a plain color.
body {
background: #ecf0f1;
}
#hex1 {
width: 200px;
height: 200px;
}
#color1 {
background-color: #D93;
}
.hexagon-wrapper {
text-align: center;
margin: 20px;
position: relative;
display: inline-block;
}
.hexagon {
height: 100%;
width: 57.735%;
display: inline-block;
}
.hexagon:before {
position: absolute;
top: 0;
right: 21.1325%;
background-color: inherit;
height: inherit;
width: inherit;
content: '';
transform: rotate(60deg);
}
.hexagon:after {
position: absolute;
top: 0;
right: 21.1325%;
background-color: inherit;
height: inherit;
width: inherit;
content: '';
transform: rotate(-60deg);
}
<div id="hex1" class="hexagon-wrapper">
<span id="color1" class="hexagon"></span>
</div>
Here is a link with the code