CSS无缝轮播广告条

<html>

<body>
  <div class="contiainer" style="--t:10s">
    <div class="animate-translateX-100">
      <span>html</span>
      <span>css</span>
      <span>js</span>
      <span>php</span>
      <span>jave</span>
      <span>vue</span>
    </div>
    <div class="animate-translateX-200">
      <span>html</span>
      <span>css</span>
      <span>js</span>
      <span>php</span>
      <span>jave</span>
      <span>vue</span>
    </div>
  </div>
</body>


</html>



<head>
  <style>
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box;
    }

    body {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
    }

    .contiainer {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 700px;
      overflow: hidden;
      background-color: yellowgreen;
    }

    .contiainer div {
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .contiainer div span {
      margin: 10px;
      letter-spacing: .2em;
      background-color: black;
      color: #fff;
      padding: 6px 10px;
      border-radius: 4px;
    }

    @keyframes animation-zvipcu {
      from {
        transform: translate(100%);
      }

      to {
        transform: translate(-100%);
      }
    }

    .animate-translateX-100 {
      animation: animation-zvipcu 10s linear infinite;
      background-color: red;
    }

    @keyframes animation-zvipcu02 {
      from {
        transform: translate(0);
      }

      to {
        transform: translate(-200%);
      }
    }

    .animate-translateX-200 {
      animation: animation-zvipcu02 10s linear infinite;
      animation-delay: calc(10s / -2);
      background-color: green;
    }
  </style>
</head>

小计:当宽度过宽时,需要将数组重复几遍,使数组的宽度达到你设置的宽度即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值