我使用以下属性创建表。我使用 cellSpacing="5"
作为空间。当我执行时,表中单元格之间的空白会很好地显示出来。 如何用另一种颜色更改鼠标悬停事件上的单元格间距空白?这可能吗?
Table Creation:
<table border="0" id="TabDeclaration" width="100%" cellpadding="5" cellspacing="3" border="2">
<tr>
<td>aaaa</td>
<td>bbbb</td>
<td>azaz</td>
</tr>
<tr>
<td>cccc</td>
<td>dddd</td>
</tr>
<tr>
<td>eeee</td>
<td>ffff</td>
</tr>
</table>
最佳答案
您可以使用以下方法更改悬停时的 background-color
:
<script>
$(function() {
$('td').hover(function() {
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
});
</script>
<style>
td {
background-color: red;
}
td.hover {
background-color: blue;
}
</style>
关于jquery - 如何在鼠标悬停事件上更改单元格间距空白?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11643517/