CSS3 implementation of logo animation effect example

Source: Internet
Author: User

Here is the case code for the demo,

<style>
. imlogo{
Display:block;
width:160px;
height:80px;
Background: #FF5E52 URL (/wp-content/uploads/2015/01/logo2.png) center 22px no-repeat;
-webkit-transition:background-position linear 2s;
-moz-transition:background-position linear 2s;
transition:background-position linear 2s;
}
. imlogo:hover{
background-position:center-48px;
}
</style>

<a class= "Imlogo" href= "#" ></a>

In fact, you only need to change the picture address, logo area size (160px and 80px) background map coordinates (22PX and -48px), you can achieve their own animation, if you are lazy, then do a 119*100px logo can, A picture like the one below (the background is transparent, PNG format enables code to change color).

Xiu Theme User Dynamic logo special program:

. Logo a{
-webkit-transition:background-position linear 2s;
-moz-transition:background-position linear 2s;
transition:background-position linear 2s;
}
. Logo a:hover{
background-position:center-48px;
}

In the theme of the Style.css finally add, and then make a original logo height of twice times the first replacement, and then change the 48 for your position can be, will not be calculated directly more than a few will know which is appropriate.

CSS3 Animation Instance

<!doctype html>

<meta charset= "Utf-8" >

<title> Animation </title>

<style>

H3{margin:0 auto;width:100px;}

. loading-demo{height:60px width:60px;margin:20px auto;position:relative;

. Act1,.act2{height:100%;width:100%;border-radius:50%;background: #26c1ce;p osition:absolute;top:0;left:0;

-webkit-animation:loading 2s infinite ease-in-out;

-moz-animation:loading 2s infinite ease-in-out;

animation:loading 2s infinite ease-in-out;

/* Animation name animation time cycle start last slow * *

Opacity:. 6;

}

/* Color deepened because of overlapping * *

. Act2{-webkit-animation-delay:-1s;}

@-webkit-keyframes loading{

0%,100%{-webkit-transform:scale (0.0)}

50%{-webkit-transform:scale (1.0)}

}

@-moz-keyframes loading{

0%,100%{-webkit-transform:scale (0.0)}

50%{-webkit-transform:scale (1.0)}

}

@keyframes loading{

0%,100%{-webkit-transform:scale (0.0)}

50%{-webkit-transform:scale (1.0)}

}

</style>

<div class= "Loading-demo" >

<div class= "Act1" ></div>

<div class= "Act2" ></div>

</div>

<body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.