将边框底部添加到表格行< tr> [英] Add border-bottom to table row <tr>

查看:119
本文介绍了将边框底部添加到表格行< tr>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3的表。我需要一个方法来添加每一行 tr 底部的边框,并给它一个特定的颜色。

I have a table of 3 by 3. I need a way to add a border for the bottom of every row tr and give it a specific color.

首先我尝试了直接的方式,即:

First I tried the direct way, i.e.:

<tr style="border-bottom:1pt solid black;">

但这没有效果。所以我添加了这样的CSS:

But that didn't work. So I added CSS like this:

tr {
border-bottom: 1pt solid black;
}

仍然无法工作。

我宁愿使用CSS,因为我不需要为每一行添加 style 属性。
我没有为< table> 添加 border 属性。我希望这不会影响我的CSS。

I would prefer to use CSS because then I don't need to add a style attribute to every row. I haven't added a border attribute to the <table>. I hope that that is not affecting my CSS.

推荐答案

我有这样的问题。我不认为 tr 可以直接采用边框样式。我的解决方法是在行中设置 td 的样式:

I had a problem like this before. I don't think tr can take a border styling directly. My workaround was to style the tds in the row:

<tr class="border_bottom">

CSS:

tr.border_bottom td {
  border-bottom:1pt solid black;
}

这篇关于将边框底部添加到表格行&lt; tr&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆