【问题标题】:I want to set the text on my animation html/css我想在我的动画 html/css 上设置文本
【发布时间】:2021-12-31 12:40:04
【问题描述】:

我想在动画上设置 h2 文本。但我不能这样做-_-。 这是实时链接http://leander.web.dnodes.net/ 源代码:https://github.com/LeleEdits/website-new

【问题讨论】:

    标签: html css web css-animations


    【解决方案1】:

    把css改成

    .h2-parent {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        max-width: 600px;
        width: 600px;
        padding-left: 10px;
        padding-right: 10px;
        z-index: 10;
    }
    h2
    {
        position: relative;
        width: 100%;
        top: 40%;
        transform: translateY(-50%);
        font-size: 5vw;
        color: rgba(255,255,255,0.5);
        text-transform: uppercase;
    }
    .abs-h2
    {
        position: absolute;
        top: 0;
        left: 0;
        width: 0;
        height: 100%;
        color: #5865f2;
        -webkit-text-stroke: 0vw rgb(51, 51, 51);
        border-right: 2px solid #5865f2;
        overflow: hidden;
        animation: animate-t 6s linear infinite;
    }
    
    .abs-h2 h2
    {
        position: relative;
        width: 600px;
        top: 40%;
        left:10px;
        transform: translateY(-50%);
        font-size: 5vw;
         color: #5865f2;
        text-transform: uppercase;
        
    }
    

    把html改成

    <div class="h2-parent">
      <h2 data-text="Improve your Server...">Improve your Server...</h2>
      <div class="abs-h2">
        <h2 data-text="Improve your Server...">Improve your Server...</h2>
      </div>
    </div>
    

    js<>fiddle中的演示

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-14
      • 1970-01-01
      • 2022-11-13
      • 1970-01-01
      • 2020-04-08
      • 1970-01-01
      相关资源
      最近更新 更多