Random Background Color Using CSS3

I think you know in today’s modern web designing there are numbers of techniques that can be used to
change randomly background color or any other animation. this is possible through CSS which allows us to achieve this through it’s light weight code structure and also specifically the additions that came with CSS3.

Here we are going to cover a great new features of CSS3 called CSS @keyframes.
This is a new feature that can be used on both HTML elements and images, but here we are creating beautiful animation using image and CSS filters. Hope you will enjoy and love it.

Example of Random Background Color

<style>
.effect1{
    float: left;
    height: 500px;
    width: 800px;
    margin: 14px;
    overflow: hidden;
    cursor:pointer;
    
    -webkit-transition: all 2s;
    -moz-transition: all 2s;
    -o-transition: all 2s;
    -ms-transition: all;
    transition: all 2s;
    
    -webkit-animation: random 20s infinite ease-in-out;
    -moz-animation: random 20s infinite ease-in-out;
    -o-animation: random 20s infinite ease-in-out;
    -ms-animation: random 20s infinite ease-in-out;
     animation: random 20s infinite ease-in-out;
}


@keyframes  random {
    20% {
        filter: saturate(500%);
        -webkit-filter: saturate(500%);
        -moz-filter: saturate(500%);
        -o-filter: saturate(500%);
        -ms-filter: saturate(500%);
    }
    40% {
        filter: hue-rotate(180deg);
        -webkit-filter: hue-rotate(180deg);
        -moz-filter: hue-rotate(180deg);
        -o-filter: hue-rotate(180deg);
        -ms-filter: hue-rotate(180deg);
    }
    60% {
        -webkit-filter: grayscale(100%);
        -moz-filter: grayscale(100%);
        -o-filter: grayscale(100%);
        -ms-filter: grayscale(100%);
    } 
    80% {
        filter: invert(1);
        -webkit-filter: invert(1);
        -moz-filter: invert(1);
        -o-filter: invert(1);
        -ms-filter: invert(1);
    }
    100% {
        filter: sepia(1);
        -webkit-filter: sepia(1);
        -moz-filter: sepia(1);
        -o-filter: sepia(1);
        -ms-filter: sepia(1);
    }  
}
</style>

<img src="http://www.phpkida.com/wp-content/uploads/2017/01/wordpress-theme-development.jpg" class="effect1" />

You Can View Demo and download Source Code of This Tutorial

If You have any question and problem in this code feel free, leave comment below! SHARE WITH YOUR FRIENDS..

Leave a Reply

Related Posts: You may like

Rotating Words with CSS Animations

Pure CSS Loader and spinners animation

Pure css drop down menu

Pure css dropdown navigation bar

Tools:

Crypto Currency

PHPKIDA provides free online the best real-time crypto market price, news, predictions, index with graphs & historical data for 2000+ coins including bitcoin, ethereum, & altcoins from major cryptocurrency exchanges.

Visite Tool

Icon Generator

PHPKIDA provides free online icon generator. Our icon generator help you to edit, modify, resize and customize icon for your website and applications. Convert to a shap you like add icon border, you can change icon border color, border size, background color, icon shadow, icons color, icon size in your own way and save it as a png image.

Visite Tool

Youtube Video Downloader

PHPKIDA provides Free online YouTube video downloader to download YouTube videos quickly in MP4, 3GP, and more. Search your video and free fast download youtube videos.

Visite Tool

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.