【发布时间】:2015-02-13 06:19:35
【问题描述】:
我想从我的表格中删除轮廓边框,即现在为黑色 1px 的顶部、底部、左侧和右侧边框。我试图改变我的 css,但它只会消除整个表格的边框。
我还想(悬停)在左侧的单元格中添加一个左粗体彩色边框。如果这有意义吗?
像这样:如果我在表格中悬停一行(就像现在一样),它会按预期着色。但我希望最左边的单元格在其左侧也有一个粗边框。此单元格:<td class="rowTitle">TITLE</td>
这是我的html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Compare Table</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<table style="width:100%" class="hoverTable">
<tr>
<td class="blankcell"></td>
<td id="check">Image</td>
<td>Image</td>
<td>Image</td>
</tr>
<tr>
<td class="rowTitle">TITLE</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td class="rowTitle">TITLE</td>
<td id="check">✔</td>
<td>✔</td>
<td>✔</td>
</tr>
<tr>
<td class="rowTitle">TITLE</td>
<td id="x01">✖</td>
<td>✖</td>
<td>✖</td>
</tr>
<tr>
<td class="rowTitle">TITLE</td>
<td>✔</td>
<td>✔</td>
<td>✔</td>
</tr>
</table>
</body>
</html>
这是我的 CSS:
th,td {
padding: 15px;
text-align: center;
}
.hoverTable tr:nth-child(even) {
background-color: #eee;
}
.hoverTable tr:nth-child(odd) {
background-color:#fff;
}
/* Upper left cell*/
.blankcell {
background: none!important;
border: none!important;
}
/* HOVER FUNCTION */
.hoverTable{
width:100%;
border-collapse:collapse;
}
.hoverTable td{
padding:7px;
border: #000000 0px solid;
}
/* Define the default color for all the table rows */
.hoverTable tr{
background: #ffffff;
border: 1px solid black;
}
/* Define the hover highlight color for the table row */
.hoverTable tr:not(:nth-child(1)):hover {
background-color: #86D694;
}
/* Check and X-Mark Coloring*/
#check {
color: #1CF200;
}
#x01 {
color: #ff6969;
}
感谢您对此事的任何帮助,谢谢!
【问题讨论】: