当前位置:Gxlcms > css > Css实现一个简单的幻灯片效果页面

Css实现一个简单的幻灯片效果页面

时间:2021-07-01 10:21:17 帮助过:70人阅读

使用animation动画实现一个简单的幻灯片效果。

  1. /**HTML**/
  2. div.ani
  3. /**css**/
  4. .ani{
  5. width:480px;
  6. height:320px;
  7. margin:50px auto;
  8. overflow: hidden;
  9. box-shadow:0 0 5px rgba(0,0,0,1);
  10. background-size: cover;
  11. background-position: center;
  12. -webkit-animation-name: "loops";
  13. -webkit-animation-duration: 20s;
  14. -webkit-animation-iteration-count: infinite;
  15. }
  16. @-webkit-keyframes "loops" {
  17. 0% {
  18. background:url(http://d.hiphotos.baidu.com/image/w%3D400/sign=c01e6adca964034f0fcdc3069fc27980/e824b899a9014c08e5e38ca4087b02087af4f4d3.jpg) no-repeat;
  19. }
  20. 25% {
  21. background:url(http://b.hiphotos.baidu.com/image/w%3D400/sign=edee1572e9f81a4c2632edc9e72b6029/30adcbef76094b364d72bceba1cc7cd98c109dd0.jpg) no-repeat;
  22. }
  23. 50% {
  24. background:url(http://b.hiphotos.baidu.com/image/w%3D400/sign=937dace2552c11dfded1be2353266255/d8f9d72a6059252d258e7605369b033b5bb5b912.jpg) no-repeat;
  25. }
  26. 75% {
  27. background:url(http://g.hiphotos.baidu.com/image/w%3D400/sign=7d37500b8544ebf86d71653fe9f9d736/0df431adcbef76095d61f0972cdda3cc7cd99e4b.jpg) no-repeat;
  28. }
  29. 100% {
  30. background:url(http://c.hiphotos.baidu.com/image/w%3D400/sign=cfb239ceb0fb43161a1f7b7a10a54642/3b87e950352ac65ce2e73f76f9f2b21192138ad1.jpg) no-repeat;
  31. }
  32. }

人气教程排行