网站链接: 我爱捣鼓
当前位置: 首页 > 前端开发 > css

css制作滑动图片幻灯片的酷炫效果

2022/10/15 11:12:44

css制作走马灯、幻灯片等效果,大家应该见的很多了,今天我们就介绍一个css制作滑动图片幻灯片的更酷炫效果的方法,如下图所示:<html class=" -webkit-"><head> <meta charset="UTF-8"> <link rel="apple-touch-icon&q…

      css制作走马灯、幻灯片等效果,大家应该见的很多了,今天我们就介绍一个css制作滑动图片幻灯片的更酷炫效果的方法,如下图所示:

2.gif


<html class=" -webkit-">
<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" type="image/png"
    href="https://cpwebassets.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png">
  <meta name="apple-mobile-web-app-title" content="CodePen">
  <link rel="shortcut icon" type="image/x-icon"
    href="https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico">
  <link rel="mask-icon" type="image/x-icon"
    href="https://cpwebassets.codepen.io/assets/favicon/logo-pin-8f3771b1072e3c38bd662872f6b673a722f4b3ca2421637d5596661b4e2132cc.svg"
    color="#111">
  <title>css制作滑动图片幻灯片的酷炫效果</title>
  <style>
    @import url(https://fonts.googleapis.com/css?family=Varela+Round);
    html,
    body {
      background: #333 url("https://codepen.io/images/classy_fabric.png");
    }
    .slides {
      padding: 0;
      width: 609px;
      height: 420px;
      display: block;
      margin: 0 auto;
      position: relative;
    }
    .slides * {
      user-select: none;
      -ms-user-select: none;
      -moz-user-select: none;
      -khtml-user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }
    .slides input {
      display: none;
    }
    .slide-container {
      display: block;
    }
    .slide {
      top: 0;
      opacity: 0;
      width: 609px;
      height: 420px;
      display: block;
      position: absolute;
      transform: scale(0);
      transition: all .7s ease-in-out;
    }
    .slide img {
      width: 100%;
      height: 100%;
    }
    .nav label {
      width: 200px;
      height: 100%;
      display: none;
      position: absolute;
      opacity: 0;
      z-index: 9;
      cursor: pointer;
      transition: opacity .2s;
      color: #FFF;
      font-size: 156pt;
      text-align: center;
      line-height: 380px;
      font-family: "Varela Round", sans-serif;
      background-color: rgba(255, 255, 255, .3);
      text-shadow: 0px 0px 15px rgb(119, 119, 119);
    }
    .slide:hover+.nav label {
      opacity: 0.5;
    }
    .nav label:hover {
      opacity: 1;
    }
    .nav .next {
      right: 0;
    }
    input:checked+.slide-container .slide {
      opacity: 1;
      transform: scale(1);
      transition: opacity 1s ease-in-out;
    }
    input:checked+.slide-container .nav label {
      display: block;
    }
    .nav-dots {
      width: 100%;
      bottom: 9px;
      height: 11px;
      display: block;
      position: absolute;
      text-align: center;
    }
    .nav-dots .nav-dot {
      top: -5px;
      width: 11px;
      height: 11px;
      margin: 0 4px;
      position: relative;
      border-radius: 100%;
      display: inline-block;
      background-color: rgba(0, 0, 0, 0.6);
    }
    .nav-dots .nav-dot:hover {
      cursor: pointer;
      background-color: rgba(0, 0, 0, 0.8);
    }
    input#img-1:checked~.nav-dots label#img-dot-1,
    input#img-2:checked~.nav-dots label#img-dot-2,
    input#img-3:checked~.nav-dots label#img-dot-3,
    input#img-4:checked~.nav-dots label#img-dot-4,
    input#img-5:checked~.nav-dots label#img-dot-5,
    input#img-6:checked~.nav-dots label#img-dot-6 {
      background: rgba(0, 0, 0, 0.8);
    }
  </style>
  <script>
    window.console = window.console || function (t) { };
  </script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
  <script>
    if (document.location.search.match(/type=embed/gi)) {
      window.parent.postMessage("resize", "*");
    }
  </script>
</head>
<body translate="no">
  <ul>
    <input type="radio" name="radio-btn" id="img-1" checked="">
    <li>
      <div>
        <img src="https://farm9.staticflickr.com/8072/8346734966_f9cd7d0941_z.jpg">
      </div>
      <div>
        <label for="img-6">‹</label>
        <label for="img-2">›</label>
      </div>
    </li>
    <input type="radio" name="radio-btn" id="img-2">
    <li>
      <div>
        <img src="https://farm9.staticflickr.com/8504/8365873811_d32571df3d_z.jpg">
      </div>
      <div>
        <label for="img-1">‹</label>
        <label for="img-3">›</label>
      </div>
    </li>
    <input type="radio" name="radio-btn" id="img-3">
    <li>
      <div>
        <img src="https://farm9.staticflickr.com/8068/8250438572_d1a5917072_z.jpg">
      </div>
      <div>
        <label for="img-2">‹</label>
        <label for="img-4">›</label>
      </div>
    </li>
    <input type="radio" name="radio-btn" id="img-4">
    <li>
      <div>
        <img src="https://farm9.staticflickr.com/8061/8237246833_54d8fa37f0_z.jpg">
      </div>
      <div>
        <label for="img-3">‹</label>
        <label for="img-5">›</label>
      </div>
    </li>
    <input type="radio" name="radio-btn" id="img-5">
    <li>
      <div>
        <img src="https://farm9.staticflickr.com/8055/8098750623_66292a35c0_z.jpg">
      </div>
      <div>
        <label for="img-4">‹</label>
        <label for="img-6">›</label>
      </div>
    </li>
    <input type="radio" name="radio-btn" id="img-6">
    <li>
      <div>
        <img src="https://farm9.staticflickr.com/8195/8098750703_797e102da2_z.jpg">
      </div>
      <div>
        <label for="img-5">‹</label>
        <label for="img-1">›</label>
      </div>
    </li>
    <li>
      <label for="img-1" id="img-dot-1"></label>
      <label for="img-2" id="img-dot-2"></label>
      <label for="img-3" id="img-dot-3"></label>
      <label for="img-4" id="img-dot-4"></label>
      <label for="img-5" id="img-dot-5"></label>
      <label for="img-6" id="img-dot-6"></label>
    </li>
  </ul>
  <script
    src="https://cpwebassets.codepen.io/assets/common/stopExecutionOnTimeout-1b93190375e9ccc259df3a57c1abc0e64599724ae30d7ea4c6877eb615f89387.js"></script>
  <script id="rendered-js">
    /*
    The only thing stopping this from being used in older browsers is the "~" selector in the last CSS rule, but since replacing it results in messy code I left it as it is.
    */
//# sourceURL=pen.js
  </script>
  <div id="xl_chrome_ext_{4DB361DE-01F7-4376-B494-639E489D19ED}" style="display: none;">
    <div></div>
    <a id="xl_chrome_ext_download" href="javascript:;">下载视频</a>
    <a id="xl_chrome_ext_close" href="javascript:;"></a>
  </div>
</body>
</html>

        查看在线实例

        通过以上内容我们知道了css如何制作一个滑动图片幻灯片的酷炫效果?感谢您访问“我爱捣鼓(www.woaidaogu.com)”网站的内容,希望对大家有所帮助!引用本文内容时,请注明出处!谢谢合作!


相关资讯

  • css实现多种促销banner样式

    电商节双十一、双十二经常需要搞促销,今天我们就来介绍几款通过css实现的促销banner样式,如下图所示:<html><head> <meta charset="UTF-8"> <link rel="apple-touch-icon" type="image/png" href="https…

    2022/11/24 12:06:35
  • css实现漂亮的苹果风格组件效果

    苹果IOS系统的界面很漂亮,今天我们就用css实现漂亮的类似苹果风格的组件效果。如下图所示:<html><head> <meta charset="UTF-8"><style data-styles="">ion-icon{visibility:hidden}.hydrated{visibility:inherit}</st…

    2022/11/24 10:36:42
  • css实现图片和背景同时滑动的酷炫效果

    我们曾经介绍过很多种图片滑动的效果,今天我们使用css实现一个图片和背景同时滑动的酷炫效果,如下图所示:<html><head> <meta charset="UTF-8"> <link rel="apple-touch-icon" type="image/png" href…

    2022/11/22 21:57:11
  • css实现酷炫Flash文字跳动动画效果

    Flash虽然已被淘汰了,但它所实现的一些效果还是非常棒的,今天我们就用css实现一个酷炫的Flash文字跳动的经典动画效果,如下图所示:<!DOCTYPE html><html><head> <meta charset="UTF-8"> <link rel="apple-touch-icon…

    2022/11/22 21:39:50
  • 设置英文首字母大写的css属性是什么?

    设置CSS text-transform 的属性为capitalize就可以实现英文首字母大写。 定义和用法  text-transform 属性控制文本的大小写。 属性值 值 描 述 none 默认。定义带有小写字…

    2021/7/14 20:35:17
  • 只让页面显示横滚动条,不显示竖滚动条如何实现?

    只让页面显示横滚动条,不显示竖滚动条的方法其实很简单,主要用到body的两个css属性 overflow和 overflow-y,如下所示:body { overflow:scroll; overflow-y:hidden;}

    2021/2/28 21:45:25
  • 网页的滚动条样式可以修改吗?如何修改?

    网页的滚动条样式可以修改的,主要是使用css来控制那如何修改呢?如下代码:<div class="inner"> <div class="innerbox"> <p style="height:200px;">这是内容111</p> <p style="hei…

    2021/2/28 21:15:24
  • css如何实现6张图片均匀排列在一行?

    css部分如下:img{width:120px; height:80px;float:left;margin-right:16px;}.img3{margin-right:0;}html部分如下:<img src="images/001.jpg" /><img src="images/002.jpg" /><img src="images/003.jpg" /><img src=…

    2021/2/28 21:10:01