答案 0 :(得分:2)
使用border-bottom/top
(仅将边界{strong> 标记为top
和bottom
)
td, th {
border-bottom: 1px solid #dddddd;
border-top: 1px solid #dddddd;
}
在这里学习:https://www.w3schools.com/css/css_border.asp
查看示例:
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border-bottom: 1px solid #dddddd;
border-top: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
答案 1 :(得分:0)
如果边框用于DIV:
border-top: 1px solid Green;
border-bottom: 1px solid Green;
希望有帮助。
答案 2 :(得分:0)
您可以使用类似
div
{
border-top-color:red;
border-bottom-color:red;
}
这将使颜色变为红色, 希望这能解决您的疑问