极光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 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置