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

    float: left;
    height: 500px;
    width: 800px;
    margin: 14px;
    overflow: hidden;
    -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);

<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

PHPKIDA Offering Free Tools:


Download Instagram Videos & Photos.

Download Now


Real Time Currency Converter

Convert Now


Robots.txt File Creater

Create Now


Compress yout HTML Code

Minify Now


Compress yout CSS Code

Minify Now


Compress yout JavaScript Code

Minify Now

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.