JSFiddle - React, Tailwind, and code Playground
by Pasia
HTML
<div class="hexrow">
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
</div>
<div class="hexrow">
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
</div>
<div class="hexrow">
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
<div></div>
</div>
</div>
<div class="hexrow">
<div>
<span></span>
<div></div>
<div></div>
</div>
<div>
<span></span>
<div></div>
...
CSS
body {
margin-top:60px;
background-color: white;
}
.hexrow {
white-space: nowrap;
/*right/left margin set at (( width of child div x sin(30) ) / 2) makes a fairly tight fit; a 3px bottom seems to match*/
margin: 0 25px 3px;
}
.hexrow > div {
width: 100px;
height: 173.2px; /* ( width x cos(30) ) x 2 */
/* For margin:
right/left = ( width x sin(30) ) makes no overlap
right/left = (( width x sin(30) ) / 2) leaves a narrow separation
*/
margin: 0 24px;
position: relative;
background-color:gray;
background-position: -50px 0; /* -left position -1 x width x sin(30) */
background-repeat: no-repeat;
background-size: auto 120%;
color: #000000;
text-align: center;
line-height: 173.2px; /*equals height*/
display: inline-block;
}
.hexrow > div:nth-child(odd) {
top: 43.3px; /* ( width x cos(30) / 2 ) */
}
.hexrow > div:nth-child(even) {
top: -44.8px; /* -1 x( ( width x cos(30) / 2) + (hexrow bottom margin / 2)) */
}
.hexrow > div > div:first-of-type {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
overflow: hidden;
background-color:gray;
-ms-transform:rotate(60deg); /* IE 9 */
-moz-transform:rotate(60deg); /* Firefox */
-webkit-transform:rotate(60deg); /* Safari and Chrome */
-o-transform:rotate(60deg); /* Opera */
transform:rotate(60deg);
}
.hexrow > div > div:first-of-type:before {
content: '';
position: absolute;
width: 200px; /* width of main + margin sizing */
height: 100%;
background-color:gray;
background-position: 0 0;
background-repeat: no-repeat;
background-size: auto 120%;
bottom: 0;
left: 0;
z-index: 1;
-ms-transform:rotate(-60deg) translate(-150px, 0); /* IE 9 */
-moz-transform:rotate(-60deg) translate(-150px, 0); /* Firefox */
-webkit-transform:rotate(-60deg) translate(-150px, 0); /* Safari and Chrome */
...