JSFiddle - React, Tailwind, and code Playground

by BurpmanJunior

HTML

<div class="fluid-diamond"><div>FLUID DIAMOND</div></div>

CSS

*{
    box-sizing: border-box;
}

/* DIAMOND WRAP */
.fluid-diamond{
    width: 30%;
    position: relative;
    background-color: #815599;
    border-radius: 0%;
    transition: transform 500ms, border-radius 500ms, background-color 500ms;
    transform: scale(1) rotate(45deg);
    transform-origin: center center;
    margin: 9%;
    cursor: pointer;
    overflow: hidden;
}

.fluid-diamond:hover,
.fluid-diamond:focus{
    background-color: #e5a10d;
    border-radius: 50%;
    transform: scale(1.333) rotate(45deg);
}

.fluid-diamond:after{
    content: '';
    padding-top: 100%;
    display: block;
}

/* DIAMOND CONTENT */
.fluid-diamond > div{
    transform: translateY(-50%) translateX(-50%) rotate(-45deg) scale(1);
    transition: transform 500ms;
    transform-origin: center center;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 75%;
    text-align: center;
    color: #fff;
    font-family: sans-serif;
    letter-spacing: 4px;
}

.fluid-diamond:hover > div,
.fluid-diamond:focus > div{
    transform: translateY(-50%) translateX(-50%) rotate(-45deg) scale(0.752);
}

JavaScript

/**
 * FLUID DIAMOND
 */