【问题标题】:How to convert paging element from PNG/SVG to HTML?如何将分页元素从 PNG/SVG 转换为 HTML?
【发布时间】:2019-10-20 10:29:37
【问题描述】:

我正在尝试将此分页设计转换为有效的 CSS/JS (see image here),但我不知道从哪里开始。有什么建议,怎么做?

P.S 这些数字必须能够动态更改。

【问题讨论】:

    标签: javascript html css svg


    【解决方案1】:

    数字可以动态更改,只需使用类 text-2text-5 为您的 div 指定 id(也更改类名),使用 document.getElementById("") 获取它们并使用 innerHTML 更改它们的值/innerText/textContent

    您的 HTML 可能如下所示。

    <div class="parent">
      <div class="line"></div>
      <div class="pagination">
        <div class="text-2">2</div>
        <div class="text-slash">/</div>
        <div class="text-5">5</div>
      </div>
      <div class="line"></div>
    </div>
    

    您的 CSS 可能如下所示

    .line {
        width: 2px;
        height: 60px;
        background-color: #000;
    }
    
    .pagination {
        display: flex;
        width: 50%;
        height: 60px;
        justify-content: center;
        align-items: center;
    }
    .text-2 {
        margin-bottom: 10px;
    }
    
    .text-slash {
        color: red;
        font-size: 20px;
    }
    
    .text-5 {
        margin-top: 10px;
    }
    
    .parent {
        display: flex;
        width: 100px;
        height: 200px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    

    【讨论】:

      猜你喜欢
      • 2020-06-22
      • 2018-02-14
      • 1970-01-01
      • 1970-01-01
      • 2015-01-31
      • 2011-08-31
      • 2011-12-31
      • 2018-09-07
      • 1970-01-01
      相关资源
      最近更新 更多