3D Chess Board Design In Html And CSS

3D Chess Board Design In Html And CSS

Html


<div class="board">
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <div class="layer"></div>
</div>

CSS


body
{
    margin: 0;
    padding: 0;
    background: #ff4181;
}
.board
{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%) rotate(-30deg) skew(25deg);
    width: 480px;
    height: 480px;
    transition: 0.5s;
    background: #000;
    box-shadow: -20px 20px 20px rgba(0,0,0,.5);
}
.board:hover
{
    top: 45%;
    box-shadow: -50px 50px 50px rgba(0,0,0,.5);
}
.board span
{
    width: 480px;
    height: 60px;
    display: block;
}
.board span:nth-child(odd)
{
    background: linear-gradient(90deg, #f1f1f1 0%, #f1f1f1 50%, #333 50%, #333 100%);
    background-size: 120px;
}
.board span:nth-child(even)
{
    background: linear-gradient(90deg, #333 0%, #333 50%, #f1f1f1 50%, #f1f1f1 100%);
    background-size: 120px;
}
.board:before
{
    content: '';
    position: absolute;
    top: 10px;
    left: -20px;
    height: 100%;
    width: 20px;
    background: linear-gradient(180deg, #fff 0%, #fff 50%, #000 50%, #000 100%);
    background-size: 5px;
    transform: rotate(0deg) skewY(-45deg);
}
.board:after
{
    content: '';
    position: absolute;
    bottom: -20px;
    left: -10px;
    height: 20px;
    width: 100%;
    background: linear-gradient(90deg, #000 0%, #000 50%, #fff 50%, #fff 100%);
    background-size: 120px;
    transform: rotate(0deg) skewX(-45deg);
}
.layer
{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,.2);
    box-shadow: -1px 1px 4px rgba(0,0,0,0.1);
    transition: 0.5s;
    overflow: hidden;
}
.board:hover .layer
{
    transform: translate(40px,-40px);
}
.layer:before
{
    content: '';
    position: absolute;
    top: 0;
    left: -70%;
    width: 50%;
    height: 100%;
    background: rgba(255,255,255,.2);
    transform: skewX(-5deg);
    transition: 0.5s;
    filter: blur(4px);
}
.board:hover .layer:before
{
    left: 120%;
}

See Demo

Leave a Comment