Split an Image using CSS


Split Image with CSS


This is a really cool program to split an image using CSS

*Featured Code Created by Calvin


 HTML with CSS


<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
        <style>
            body {
    background-color: beige;
}

.bg {
    width: 170px;
    height: 170px;
    background-image: url(https://www.dropbox.com/s/5zursiwsf8zxogr/r2d2-dessert.jpg?raw=1);
    position: absolute;
    top: 10px;
    left: 10px;
    box-shadow: 0px 0px 0px gray;
    
    
}

.bg1 {
    background-position: 0px 0px;
    transform: rotate(0deg);
    animation: b1 5s linear 5s 1 forwards;
}


.bg2 {
    background-position: 170px 0;
    left: 180px;
    transform: rotate(0deg);
    animation: b2 5s linear 5s 1 forwards;
}

.bg3 {
    background-position: 0 170px;
    top: 180px;
    transform: rotate(0deg);
    animation: b3 5s linear 5s 1 forwards;
}


.bg4 {
    background-position: 170px 170px;
    left: 180px;
    top: 180px;
    transform: rotate(0deg);
    animation: b4 5s linear 5s 1 forwards;
}

@keyframes b1 {
    to {
        background-position: 0px 0px;
        transform: rotate(5deg);
        box-shadow: 2px 2px 2px gray;
    }
}


@keyframes b2 {
    to {
        left: 220px;
        transform: rotate(-2deg);
        box-shadow: 2px 2px 2px gray;
    }
}

@keyframes b3 {
    to {
        top: 250px;
        transform: rotate(3deg);
        box-shadow: 2px 2px 2px gray;
    }
}

@keyframes b4{
    to {
        left: 220px;
        top: 230px;
        transform: rotate(-2deg);
        box-shadow: 2px 2px 2px gray;
    }
}

        </style>
        
    </head>
    <body>
       <div class="bg bg1"></div>
       <div class="bg bg2"></div>
       <div class="bg bg3"></div>
       <div class="bg bg4"></div>
    </body>

Comments

Popular posts from this blog