Add border to Hexagons

I am trying to add an 8px border to the hexagons in the grid in the following code.

<!DOCTYPE html>
<html lang="en" >

<head>

<!--
Copyright (c) 2018 by Leon Heess (https://codepen.io/MiXT4PE/pen/JZBjog)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

 <meta charset="UTF-8">
 <title>Flipping Hexagons</title>
 <style>
 html, body {
 font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", "sans-serif";
 background-color: #1c1c1c;
 height: 100%;
}

.wrapper {
 display: flex;
 height: 100%;
 justify-content: center;
 align-items: center;
}

#hexGrid {
 display: flex;
 flex-wrap: wrap;
 width: 50%;
 padding-bottom: 5.5%;
 overflow: hidden;
 list-style-type: none;
}

.hex {
 position: relative;
 visibility: hidden;
 outline: 1px solid transparent;
 width: 25%;
}

.hex:nth-child(7n + 5) {
 margin-left: 12.5%;
}

.hex::after {
 content: "";
 display: block;
 padding-bottom: 86.602%;
}

.hexFront, .hexBack {
 perspective: 800;
 transform-style: preserve-3d;
 transform: rotateY(0deg);
 backface-visibility: hidden;
 transition: transform 1s ease-out, opacity 0.5s ease-out;
}

.hexBack {
 opacity: 0;
 transform: rotateY(180deg);
}

.hexIn {
 position: absolute;
 width: 96%;
 padding-bottom: 110.851%;
 margin: 0 2%;
 overflow: hidden;
 visibility: hidden;
 outline: 8px solid transparent;
 transform: rotate3d(0, 0, 1, -60deg) skewY(30deg);
}

.hexInner {
 position: absolute;
 visibility: visible;
 outline: 8px solid transparent;
 background-color: #fff;
 display: flex;
 justify-content: center;
 align-items: center;
 width: 100%;
 height: 100%;
 overflow: hidden;
 transform: skewY(-30deg) rotate3d(0, 0, 1, 60deg);
}

.hexInner img {
 left: -100%;
 right: -100%;
 width: auto;
 height: 100%;
 margin: 0 auto;
 transform: rotate3d(0, 0, 0, 0deg);
 filter: grayscale(100%);
 transition: 4s;
}

.hexInner img:hover {
 filter: grayscale(0%);
 transition: 0s;
}

.hexInner p {
 color: black;
 text-align: center;
 text-transform: uppercase;
 font-weight: 300;
 font-size: 2vw;
 margin: 0;
}
 </style>

</head>

<body>

 <div class="wrapper">
 <ul id="hexGrid">
 <li class="hex">
 <div class="hexFront">
 <div class="hexIn">
 <div class="hexInner">
 <img src="https://picsum.photos/500/?random" alt="#" />
 </div>
 </div>
 </div>
 <div class="hexBack">
 <div class="hexIn">
 <div class="hexInner">
 <p> backside </p>
 </div>
 </div>
 </div>
 </li>
 <li class="hex">
 <div class="hexFront">
 <div class="hexIn">
 <div class="hexInner">

 </div>
 </div>
 </div>
 <div class="hexBack">
 <div class="hexIn">
 <div class="hexInner">
 <p> backside </p>
 </div>
 </div>
 </div>
 </li>
 <li class="hex">
 <div class="hexFront">
 <div class="hexIn">
 <div class="hexInner">
 <img src="https://picsum.photos/500/?random" alt="#" />
 </div>
 </div>
 </div>
 <div class="hexBack">
 <div class="hexIn">
 <div class="hexInner">
 <p> backside </p>
 </div>
 </div>
 </div>
 </li>
 <li class="hex">
 <div class="hexFront">
 <div class="hexIn">
 <div class="hexInner">
 <img src="https://picsum.photos/500/?random" alt="#" />
 </div>
 </div>
 </div>
 <div class="hexBack">
 <div class="hexIn">
 <div class="hexInner">
 <p> backside </p>
 </div>
 </div>
 </div>
 </li>
 </ul>
</div>
 <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>

 <script>
 $(document).ready(function() {
 "use strict";
 $(".hexFront, .hexBack").click(function() {
 $(".hexFront")
 .css({ transform: "rotateY(0deg)", opacity: 1 })
 .next()
 .css({ transform: "rotateY(180deg)", opacity: 0 })

 $(this)
 .css({ transform: "rotateY(180deg)", opacity: 0 })
 .next()
 .css({ transform: "rotateY(0deg)", opacity: 1 })
 .end().prev()
 .css({ transform: "rotateY(0deg)", opacity: 1 });
 });
});
 </script>

</body>

</html>

@choltzman,

Does:

.hexFront {
 border: 8px solid #000;
}

work?

nope. Tried it. Thanks though.

Also on mobile view its barely visible. Is there a away to add a media query so the grid doesn’t shrink or shrinks less?

Thanks

@choltzman,

http://jsfiddle.net/1gfm9q6u/11/

I added an extra element:

<li class="hex">
 <div class="hexFront">
 <div class="hexIn">
 <div class="hexInner">
 <div class="hexIn hexInIn">
 </div>
 </div>
 </div>
 </div>
 <div class="hexBack">
 <div class="hexIn hexInIn">
 <div class="hexInner">
 <p> backside </p>
 </div>
 </div>
 </div>
 </li>

Then changed some css:

.hexInner {
 position: absolute;
 visibility: visible;
 outline: 8px solid transparent;
 background-color: #fff;
 display: flex;
 justify-content: center;
 align-items: center;
 width: 100%;
 height: 100%;
 box-sizing: border-box;
 border: 8px solid red;
 overflow: hidden;
 transform: skewY(-30deg) rotate3d(0, 0, 1, 60deg);
}

.hexInIn {
 border: 11px solid red;
 visibility: visible;
 background: transparent;
 width: 96%;
 padding-bottom: 114%;
 transform: rotate3d(0, 0, 1, -60deg) skewY(30deg) translate(-2%, -2%);
 margin: 0 2%;
}

You can copy and paste to add this to add the new element, replace the ‘.hexInner’ css and add the ‘hexInIn’ css to the bottom of the css file.