gpt4 book ai didi

html - 列表项中的 CSS 边框

转载 作者:行者123 更新时间:2023-11-28 00:23:13 24 4
gpt4 key购买 nike

您好,我在列表项中使用边框时遇到问题。
我想让

  • 中的所有元素都有边框,但是超过窗口宽度的
  • 会在右侧丢失边框。我该如何解决这个问题?
    这是示例 fiddle :https://jsfiddle.net/zmLp86dy/

    .line-row {
    list-style: none;
    font-size: 0;
    height: 22px;
    margin-top: 2px;
    padding-inline-start: 0;
    }

    .line-row li {
    display: inline-block;
    border-radius: 0%;
    width: 35px;
    height: 20px;
    margin-top: 2px;
    background: #737373;
    border: 1px solid #000;
    border-right: 0px;
    }

    .line-row li:nth-last-of-type(1) {
    border-right: 1px solid #000;
    }

    ul li.success {
    background: #00ff00;
    }

    ul li.delayed {
    background: #ff0000;
    }

  • 最佳答案

    使用轮廓而不是边框​​,您不再需要删除 border-right。简单地增加 margin-top 因为在高度计算和位置中不考虑轮廓:

    .line-row {
    list-style: none;
    font-size: 0;
    height: 22px;
    margin-top: 2px;
    }

    .line-row li {
    display: inline-block;
    border-radius: 0%;
    width: 35px;
    height: 20px;
    margin-top: 4px;
    background: #737373;
    outline: 1px solid #000;
    }

    ul li.success {
    background: #00ff00;
    }

    ul li.delayed {
    background: #ff0000;
    }
    <div class="timeline" style="display: inline-block;">
    <ul class="batch line-row">
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    <li class="success"></li>
    </ul>
    </div>

    关于html - 列表项中的 CSS 边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54777035/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com