【发布时间】:2021-01-29 20:41:17
【问题描述】:
我的代码如下,我想在表格中添加水平线来分隔每一行的内容:
.Favourites-table {
position: relative;
width: 70%;
text-align: center;
/*border: 1px solid orangered;*/
margin: 0 auto;
top: 130px;
height: 300px;
}
.Favourites-table th {
position: relative;
border: 1px solid orangered;
color: #fd886b;
width: 100%;
height: 300px;
}
.horizontal-line {
position: relative;
width: 100%;
background-color: orangered;
padding: 1px 0px;
}
.Favourites-table tr {
position: relative;
border: 1px solid orangered;
width: 100%;
height: 100px;
}
<table class="Favourites-table">
<tr class="Favourites-titlerow">
<th>Search name</th>
<th>Email notifications</th>
<th>options</th>
</tr>
<tr class="Favourites-row">
<td>
<image src="../1x/"></image>
<h4>wetpoo</h4>
</td>
<td><span id="emailnotify-on" style="display: none;"><a href="#">On</a></span> <span class="hide-off" id="emailnotify-off" style="display: inline;"><a href="#">Off</a></span></td>
<td> <a class="delete-row" href="#">Delete <a class="edit-search" href="#">Edit search</a></td>
</tr>
<tr class="Favourites-row">
<td></td>
<td></td>
<td></td>
</tr>
</table>
我尝试设置 TH 和 TR 的样式以添加该行,我还尝试使用 <hr> 创建一个行并将其添加到表中,但我无法让它工作。
【问题讨论】:
-
你有没有尝试过,你能分享那个 CSS 吗?你在哪里卡住了?
-
是的,我尝试设置
和 的样式以添加水平线,我还尝试使用
手动将其添加到表格中,但我无法正确处理跨度>出于好奇,什么是“湿便”?顺便说一句,这是<img />,而不是<image></image>。wetpoo 只是一些测试数据