极光0421 2021-11-29 11:06 采纳率: 60%
浏览 16
已结题

DIV背景颜色在框内左右滑动,框外的隐藏,当颜色移入框内是显示

**HTML**

<div class="box">
    <div>2位学号姓名</div>
    <div>2位学号姓名</div>
    <div>2位学号姓名</div>
</div>
<div class="box1"></div>
**CSS**

*{
        margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.5s ease-out;
}
.box{
    width: 1580px;
    height: 210px;
    margin: auto;
    margin-top: 50px;
}
.box div:nth-child(1){
    background-color: red;
}
.box div:nth-child(2){
    background-color: dodgerblue;
}
.box div:nth-child(3){
    background-color: green;
}
@keyframes circleRoate{
    0%{
        transform: translateX(0%);
        -webkit-transform: translateX(0%);
    }
    50%{
        transform: translateX(610px);
        -webkit-transform: translateX(610px);
    }
    100%{
        transform: translateX(0%);
        -webkit-transform: translateX(0%);
    }
}
.box div{
    width: 300px;
    height: 200px;
    font-size: 30px;
    float: left;
    text-align: center;
    color: white;
    line-height: 200px;
    animation: circleRoate 5s infinite linear;
    -webkit-animation: circleRoate 5s infinite linear;
}
.box1{
    width: 310px;
    height: 210px;
    margin: auto;
    position: fixed;
    top: 6%;
    left: 38%;
    border: 6px solid darkgray;
}

img

  • 写回答

1条回答 默认 最新

  • 你好!机器人 2021-11-29 11:10
    关注

    把box放在box1里面,box1再加个overflow:hidden

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 12月7日
  • 已采纳回答 11月29日
  • 创建了问题 11月29日

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)