自动滚动和循环内容DIV

<!-- HTML Version Declaration -->
<!DOCTYPE html>
<!-- HTML Root Element -->
<html>
<!-- HTML Head Section -->

<head>
    <!-- HTML Document Title -->
    <title>This is Title</title>
    <style type="text/css" media="all">
        #scrollingDiv {
            height: 400px;
            overflow: hidden;
        }

        #scrollingDiv ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            animation: scroll 10s infinite;
        }

        @keyframes scroll {
            0% {
                transform: translateY(0);
            }

            25% {
                transform: translateY(-50%);
            }

            50% {
                transform: translateY(-100%);
            }

            75% {
                transform: translateY(-150%);
            }

            100% {
                transform: translateY(0);
            }
        }
    </style>
</head>

<body>
    <div id="scrollingDiv">
        <ul>
            <li>内容1</li>
            <li>内容2</li>
            <li>内容3</li>
            <li>内容4</li>
            <li>内容5</li>
            <li>内容6</li>
        </ul>
    </div>
    <script>

        window.onload = function () {
            var scrollingDiv = document.getElementById("scrollingDiv");
            var ul = scrollingDiv.querySelector("ul");
            var liHeight = ul.querySelector("li").offsetHeight;
            var totalHeight = liHeight * ul.children.length;
            scrollingDiv.style.height = liHeight + "px";
            ul.style.height = totalHeight + "px";
        }
    </script>

</body>

</html>

 

<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>marquee</title>
</head>
 
<body>
    <marquee direction="up">我向上滚动</marquee>
    <hr>
    <marquee direction="down">我向下滚动</marquee>
    <hr>
    <marquee direction="left">我向左滚动</marquee>
    <hr>
    <marquee direction="right">我向右滚动</marquee>
    <hr>
    <marquee scrollamount="10">我速度很慢</marquee>
    <hr>
    <marquee scrollamount="100">我速度很快</marquee>
    <hr>
    <marquee scrolldelay="30">我小步前进。</marquee>
    <hr>
    <marquee scrolldelay="1000" scrollamount="100">我大步前进。</marquee>
    <hr>
    <marquee loop="1">我滚动一次</marquee>
    <hr>
    <marquee loop="2">我滚动两次</marquee>
    <hr>
    <marquee loop="infinite">我无限循环滚动</marquee>
    <hr>
    <marquee behavior="alternate">我来回滚动</marquee>
    <hr>
    <marquee behavior="scroll">我单方向循环滚动</marquee>
    <hr>
    <marquee behavior="scroll" direction="up" height="30">我单方向向上循环滚动</marquee>
    <hr>
    <marquee behavior="slide">我只滚动一次</marquee>
    <hr>
    <marquee behavior="slide" direction="up">我向上只滚动一次</marquee>
    <hr>
    <marquee behavior=="slide" direction="left" bgcolor="red">我的背景色是红色的</marquee>
    <hr>
    <marquee width="600" height="50" bgcolor="red">我宽300像素,高30像素。</marquee>
    <hr>
    <marquee width="300" height="30" vspace="10" hspace="10" bgcolor="red">我矩形边缘水平和垂直距周围各10像素。</marquee>
    <hr>
    <marquee width="300" height="30" vspace="50" hspace="50" bgcolor="red">我矩形边缘水平和垂直距周围各50像素。</marquee>
    <hr>
    <marquee align="absbottom">绝对底部对齐</marquee>
    <hr>
    <marquee align="absmiddle">绝对中央对齐</marquee>
    <hr>
    <marquee align="baseline">底线对齐</marquee>
    <hr>
    <marquee align="bottom">底部对齐(默认)</marquee>
    <hr>
    <marquee align="left">左对齐</marquee>
    <hr>
    <marquee align="middle"> 中间对齐</marquee>
    <hr>
    <marquee align="right">右对齐</marquee>
    <hr>
    <marquee align="texttop">顶线对齐</marquee>
    <hr>
    <marquee align="top">顶部对齐</marquee>
</body>
 
</html>

 

<div style="transform: translate(0px, -44.2px); transition: ease-in; overflow: hidden;">
<
div style="overflow: hidden;">
<
div data-v-60fe2c19="" class="leftcon"><p data-v-60fe2c19="" style="border-bottom: medium; margin-right: 10px; color: rgb(255, 255, 255);"> </div>
</
div>
</
div>

 

posted @ 2024-10-05 21:53  emanlee  阅读(15)  评论(0编辑  收藏  举报