zoukankan      html  css  js  c++  java
  • 实现文字横向滑动

    用html和css实现文字在滚动区域内横向循环滚动

    实现效果如下:

    代码如下:

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>纯css实现文字循环滚动效果</title>
        <style type="text/css">
            * {
                margin: 0;
                padding: 0;
            }
     
            .box {
                width: 600px;
                margin: 30px auto;
                border: 1px solid #ff6700;
                overflow: hidden;
            }
     
            .animate {
                padding-left: 20px;
                font-size: 12px;
                color: #000;
                display: inline-block;
                white-space: nowrap;
                animation: 5s wordsLoop linear infinite normal;
            }
     
            @keyframes wordsLoop {
                0% {
                    transform: translateX(500px);  /*调整滚动区域宽度*/
                    -webkit-transform: translateX(500px);   /*调整滚动区域宽度*/
                }
                100% {
                    transform: translateX(-100%);
                    -webkit-transform: translateX(-100%);
                }
            }
     
            @-webkit-keyframes wordsLoop {
                0% {
                    transform: translateX(500px);   /*调整滚动区域宽度*/
                    -webkit-transform: translateX(500px);    /*调整滚动区域宽度*/
                }
                100% {
                    transform: translateX(-100%);
                    -webkit-transform: translateX(-100%);
                }
            }
        </style>
    </head>
    <body>
    <div class="box">
        <div class="animate">
            文字滚动的内容
        </div>
    </div>
    </body>
    </html>
  • 相关阅读:
    9、 docker容器数据卷
    第十八章 MySQL数据库优化
    第十七章 MySQL的VIP漂移和Atlas
    第十六章 MHA高可用(续)
    第一章 shell基础
    第十五章 MHA高可用
    第十四章 MySQL的各种主从
    第十三章 MySQL的主从复制
    第十二章 MySQL的恢复与备份
    第十一章 MySQL日志详解
  • 原文地址:https://www.cnblogs.com/mfbzr/p/13985687.html
Copyright © 2011-2022 走看看