【发布时间】:2017-11-19 17:58:40
【问题描述】:
如果我有以下代码,我会添加什么来使一行作为链接可点击? (温柔,我是新手)我已经尝试了几件事,但我对此很陌生,所以我很难做到正确:
.hoverTable {
width: 700px;
border-collapse: collapse;
}
.hoverTable td {
padding: 7px;
border: #315795 1px solid;
font-family: "tradegothic";
font-size: 14px;
color: #315795;
}
/* Define the default color for all the table rows */
.hoverTable tr {
background: #bec7d6;
}
/* Define the hover highlight color for the table row */
.hoverTable tr:hover {
background-color: #315795;
color: #ffffff;
}
/* Define the hover highlight color for the table row */
.hoverTable td:hover {
background-color: #315795;
color: #ffffff;
}
<table class="hoverTable" style="width: 700px;">
<tbody>
<tr class="clickable-row" data-href="mathdept.ucr.edu">
<td colspan="3"><strong><a>CENTER FOR MATHEMATICAL & COMPUTATIONAL MODELING IN BIOLOGY & MEDICINE<span style="float: right;">►►</span></a><br /></strong></td>
</tr>
<tr>
<td colspan="3"><strong>OUR PEOPLE - COMMITTEES <span style="float: right;">►►</span></strong></td>
</tr>
<tr>
<td colspan="3"><strong>SEMINARS, COLLOQUIUM, CONFERENCES & RESEARCH <span style="float: right;">►►</span></strong></td>
</tr>
</tbody>
</table>
【问题讨论】:
-
“可点击”是什么意思?您是否希望用户单击一行并导致导航发生?
-
我看到您在具有相对 URL 的行上有一个数据属性。您需要使用 Javascript/jQuery 才能使其正常工作。
标签: html css hyperlink html-table