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

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

问题描述

我有一个 3 x 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 属性.我没有向

添加 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: 1px solid black;
}

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

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