代码之家  ›  专栏  ›  技术社区  ›  Marcus Edensky

CSS-表格单元格上带有右箭头的表格进度条

  •  0
  • Marcus Edensky  · 技术社区  · 6 年前

    我需要做一个进度条使用 <table> . 我希望阶梯元素的右边有一个箭头。这是我想要的.jpg:

    Progress bar with steps with right arrows

    这是我目前掌握的代码:

    <table class="progress-steps">
        <tr>
            <td class="step-done">Select tours</td>
            <td class="step-active">Enter info</td>
            <td class="step-unfinished">Confirm</td>
            <td class="step-unfinished">Pay</td>
        </tr>
    </table>
    
    <style>
    .progress-steps {
        width: 100%;
        font-weight: bold;
        border-collapse: collapse;
    }
    
    .progress-steps td {
        border-right: 4px solid #ffffff;
        padding: 10px 20px;
        text-align: center;
    }
    
    .progress-steps td:last-of-type {
        border-right: none;
    }
    
    .step-done {
        background-color: #305599;
        color: #849fd4;
    }
    
    .step-active {
        background-color: #5f81c1;
        color: #ffffff;
    }
    
    .step-unfinished {
        background-color: #ffffff;
        color: #9fb6df;
    }
    
    .step-unfinished {
        border-right-color: #9fb6df !important;
    }
    </style>
    

    我怎样才能做到这一点?

    0 回复  |  直到 6 年前
        1
  •  1
  •   Marco Ferrantini    6 年前

    你需要的是“面包屑”。网上有很多例子。从概念上讲,我建议使用无序列表而不是表。这对我来说更有意义。 This