• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

HTML/CSS 使用css做轮播图

武飞扬头像
xieTing.
帮助1

一、什么是轮播图

轮播图其实就是将照片水平放置,设置一个只有显示一张照片大小的窗口,多张图片重复播放形成。

二、轮播图的基本功能:

第一,能够左右切换。

第二,自动播放。

第三,按下面的按钮能够跳转到固定页面。

第四,当把鼠标放在图上时,轮播停止。

三、如何做轮播图

具体操作如下:

  1.  
    <!DOCTYPE html>
  2.  
    <html lang="en">
  3.  
    <head>
  4.  
    <meta charset="UTF-8">
  5.  
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.  
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.  
    <title>Document</title>
  8.  
    <style>
  9.  
    .box{
  10.  
    position: relative;
  11.  
    }
  12.  
    .box > img{
  13.  
    width: 100%;
  14.  
    }
  15.  
    .left-icon,
  16.  
    .right-icon{
  17.  
    width: 50px;
  18.  
    height: 50px;
  19.  
    background-color: rgba(255, 204, 0, 0.6);
  20.  
    font-size: 30px;
  21.  
    color: white;
  22.  
    display: flex;
  23.  
    justify-content: center;
  24.  
    align-items: center;
  25.  
    }
  26.  
    .left-icon{
  27.  
    border-bottom-right-radius: 50%;
  28.  
    border-top-right-radius: 50%;
  29.  
    position: absolute;
  30.  
    left: 0px;
  31.  
    top: calc(50% - 50px);
  32.  
    }
  33.  
    .right-icon{
  34.  
    border-bottom-left-radius: 50%;
  35.  
    border-top-left-radius: 50%;
  36.  
    position: absolute;
  37.  
    right: 0;
  38.  
    top: calc(50% - 50px);
  39.  
    }
  40.  
    .circle-box{
  41.  
    position: absolute;
  42.  
    bottom: 20px;
  43.  
    left: calc(50% - 100px);
  44.  
    background-color: #333;
  45.  
    width: 200px;
  46.  
    height: 30px;
  47.  
    display: flex;
  48.  
    justify-content: center;
  49.  
    align-items: center;
  50.  
    }
  51.  
    .circle-box > span{
  52.  
    display: flex;
  53.  
    width: 10px;
  54.  
    height: 10px;
  55.  
    border: 1px solid white;
  56.  
    margin: 0 10px;
  57.  
    border-radius: 50%;
  58.  
    }
  59.  
    </style>
  60.  
    </head>
  61.  
    <body>
  62.  
    <div class="box">
  63.  
    <img src="https://t7.百度.com/it/u=308796380,4027222542&fm=193&f=GIF">
  64.  
    <div class="left-icon">&lt;</div>
  65.  
    <div class="right-icon">&gt;</div>
  66.  
    <div class="cricle-box">
  67.  
    <span></span>
  68.  
    <span></span>
  69.  
    <span></span>
  70.  
    <span></span>
  71.  
    <span></span>
  72.  
    </div>
  73.  
    </div>
  74.  
    </body>
  75.  
    </html>
学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfbiib
系列文章
更多 icon
同类精品
更多 icon
继续加载