CSS3-定位-轮播图案例

代码:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      /* 
      CSS书写顺序:
        1.改变元素显示模式的属性:display:block;float:position
        2.和盒子相关的:width,height,border,padding,margin,background..
        3.和文本样式相关的:color,fz,fs,fw,ff,tac,td,lh...
        4.css3新增的一些属性:bdrd,box-shadow,cursor...
      */
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      li {
        /* lin */
        list-style: none;
      }
      .box {
        /* 父相 por */
        position: relative;
        width: 520px;
        height: 292px;
        background-color: skyblue;
        margin: 100px auto;
      }
      .prev,
      .next {
        /* 子绝 poa */
        position: absolute;
        top: 50%;
        margin-top: -25px;
        width: 30px;
        height: 50px;
        /* 清除边框 */
        border: 0;
        background-color: rgba(255, 255, 255, 0.6);
        font-size: 30px;
        font-family: 宋体;
        font-weight: 700;
        color: #fff;
        cursor: pointer;
      }
      .prev {
        left: 0;
        border-radius: 0 25px 25px 0;
      }
      .next {
        right: 0;
        border-radius: 25px 0 0 25px;
      }
      .box ul {
        position: absolute;
        bottom: 15px;
        left: 50%;
        margin-left: -50px;
        width: 100px;
        height: 20px;
        background-color: rgba(255, 255, 255, 0.6);
        border-radius: 10px;
      }
      .box li {
        float: left;
        width: 10px;
        height: 10px;
        background-color: #fff;
        margin: 5px;
        border-radius: 50%;
        /* cu */
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <img src="./images/sg.jpg" alt="" />

      <!-- 两个按钮 -->
      <button class="prev">&lt;</button>
      <button class="next">&gt;</button>

      <!-- 轮播图指示器 -->
      <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </body>
</html>

效果图:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Q _Q

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值