JSFiddle - React, Tailwind, and code Playground

by Sean Coker

HTML

<div class="hexrow">
    <div>
        <span>Any text you would like (that fits).</span>
        <div></div>
        <div></div>
    </div>
    <div>
        <span>Really, change the text to say what you want!</span>
        <div></div>
        <div></div>
    </div>
    <div>
        <span>I'm not kidding here.</span>
        <div></div>
        <div></div>
    </div>
    <div>
        <span>Okay?</span>
        <div></div>
        <div></div>
    </div>
</div>

<div class="hexrow">
    <div>
        <span>Did I mention you can change images? I mean, really, these are just rectangular images "cropped" to a hex shape (well, more complicated than just a crop, but the result is the same).</span>
        <div></div>
        <div></div>
    </div>
    <div>
        <span>See, another image!</span>
        <div></div>
        <div></div>
    </div>
    <div>
        <span>Testing opacity.</span>
        <div></div>
        <div></div>
    </div>
    <div>
        <span>Satisfied?</span>
        <div></div>
        <div></div>
    </div>
</div>

CSS

body {
    background-color: cyan;
}

.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 25px; 
    position: relative;
    background-image: url(http://i1166.photobucket.com/albums/q605/Artem_Lebedev/dog-training-collars.jpg);
    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-image: inherit;
    
    -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-image: inherit;
    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 */
   ...