简体   繁体   English

无法在表格行的底部显示边框

[英]Having trouble getting a border to appear at the bottom of my table row

I'm trying to have padding within my table row and have a bottom border for my row. 我正在尝试在表格行中添加填充并为行添加底边框。 So I have: 所以我有:

.subscription-row {
    background-color: cyan;
    min-height: 30px;
    border-color: transparent;
    border-style: solid;
    border-width: 22px 16px 42px 20px; 
    border-bottom: 1px solid #C7CDD1;
}

on this HTML 在这个HTML上

<table id="subscriptions-table">
    <thead>
        <tr>
            <th>Subscription</th>
            <th>Download</th>
        </tr>
    </thead>
    <tbody>
        <tr class="even subscription-row header">
                <td class="ig-header-title ellipsis">
                <img src="/assets/s-icon-0d60471f901d65172728d3df0e793b2ee4493a529c1a1dca73409fdae56ad362.png" alt="S icon">
                <a class="name ellipsis" target="_blank" href="/scenarios/18">My Scenario</a>
            </td>  
            <td align="center"><a href="/scenarios/18/download"><img src="/assets/zip_icon-c2a0694959db12a0939d264d4283478c1f59a4b118df839d7020aca929a1df61.png" alt="Zip icon"></a></td>
        </tr> 
    </tbody>
</table>

but the bottom border is not showing up the desired number of pixels away from the padding — https://jsfiddle.net/z13jdLk5/ . 但底部边框并未显示出距填充处所需的像素数-https: //jsfiddle.net/z13jdLk5/ How can I force my solid border on the bottom of my row only while ensuring the appropriate amount of padding that I specified? 仅在确保我指定的适当填充量的同时,如何才能将实心边框强制在行的底部?

You can achieve padding by targeting the td inside of the subscription-row, and adding some padding to it. 您可以通过针对预订行内的td并向其中添加一些填充来实现填充。

    .subscription-row td {
        padding-bottom:10px;
    }

Do note that if you use your current subscription-row class for your subsequent row styling, it will look as if only the bottom-most row will have the transparent row color you expected it to have. 请注意,如果您将当前的subscription-row类用于后续的行样式,则看起来只有最底部的行将具有您期望的透明行颜色。 That is because the top of the row border has a transparent border styling which overwrites the previous row's bottom border styling. 这是因为行边框的顶部具有透明的边框样式,该样式覆盖了前一行的底部边框样式。

Look here to understand more about your current problem >> Add border-bottom to table row <tr> 查找此处以了解有关当前问题的更多信息>> 在表行<tr>中添加border-bottom

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM