用css实现图片像蹦起来一样。
效果:
代码如下:
.logo { background-image: url(logo.png); background-repeat: no-repeat; height: 150px; margin: 50px; width: 154px; } .logo:hover { animation-name: bounce; animation-duration: 0.5s; animation-timing-function: linear; animation-iteration-count: 1; } @keyframes bounce { 45% { height: 130px; margin-top: 70px; } 55% { height: 130px; margin-top: 70px; } 75% { height: 170px; margin-top: 0px; } }