html - <li> 元素需要 css 动画循环

标签 html css

我终于设法在到达断点时停止列表模糊一秒钟,但我现在如何循环列表?目前它在最后一个要点之后结束。

@media screen and (max-width: 1023px) {

    li {
        position: absolute;
        top: 0;
        left: 0;
        width:100%;
        opacity: 0;


        animation: fadeOut 3s ease-out forwards ;



        -webkit-animation: fadeOut 3s ease-out forwards;
        animation: fadeOut 3s ease-out forwards ;





    }

    @-webkit-keyframes fadeOut {
        0% {
            opacity: 0;
        }
        50% {
            opacity: 1;
        }
        100% {
            opacity: 0;
        }
    }
    @keyframes fadeOut {
        0% {
            opacity: 0;

        }
        50% {
            opacity: 1;
        }
        100% {
            opacity: 0;
        }
    }

    li:nth-child(1) {
        animation-delay: 0s;

    }

    li:nth-child(2) {
        animation-delay: 3s;
    }

    li:nth-child(3) {
        animation-delay: 6s;
    }

    li:nth-child(4) {
        animation-delay: 9s;
    }

}

理想情况下我不想使用 JS,所以我是否必须为每个 LI 的淡入/淡出设置一个关键帧事件?这是一个 JSFiddle - https://jsfiddle.net/1gvywmda/1/

最佳答案

我已经更新了答案:

https://jsfiddle.net/jwc9rem5/3/

@media screen and (max-width: 1023px) {  
    .usp-line li:first-child {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }

    .usp-line li:not(:first-child) {
        opacity: 0;
        transition: opacity .7s;
    }
}

关于html - <li> 元素需要 css 动画循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54482180/

相关文章:

JavaScript +css - 更改主类别的复选框 css,如果它下面的任何元素被选中

html - 如何修复与另一个元素内联的元素,而不管前一个元素的大小

javascript - IP 屏蔽 HTML 输入表单与 jQuery

html - 带有交叉淡入淡出图像的导航 html5 css3

javascript - 高度过渡无法使用 javascript

javascript - html 图像标题仅适用于两侧的鼠标

html - 无法在小型移动设备屏幕上居中 Bootstrap 媒体卡

html - Google Chrome &lt;input/> 自动填充背景颜色在版本 72.0 中是否发生了变化?

css - 我的设备分辨率为 720px,但在浏览器中宽度为 360px

html - 如何将文本移动到 CSS 中复选框的右侧?