【发布时间】:2011-12-18 00:54:49
【问题描述】:
我在这里看过几篇关于这个主题的帖子,我已经阅读了 W3C 关于边框样式冲突解决的规范(承认,我不完全明白),但我不知道如何实现我想要的是。
在行悬停时,我想更改行周围边框的颜色。我推测最好的跨浏览器方法是更改该行中的 td 边框颜色。但是,我似乎无法以行的顶部边框也发生变化的方式执行它。
这是我的 CSS:
#dataGrid table {
border: 1px solid #cacac8; /* I've tried it with and without this border setting */
table-layout: fixed;
border-collapse: collapse;
}
#dataGrid td {
border: 1px solid #cacac8;
padding: 8px 11px 7px 11px;
text-align: left;
}
#dataGrid .cellHovered {
border-top: 1px solid #425474;
border-bottom: 1px solid #425474;
}
#dataGrid .cellFirstHovered {border-left: 1px solid #425474;}
#dataGrid .cellLastHovered {border-right: 1px solid #425474;}
还有我的 JQuery:
$('div#dataGrid tr.dataRow').hover(
function () {
$(this).children('td').addClass('cellHovered');
$(this).children('td:first').addClass('cellFirstHovered');
$(this).children('td:last').addClass('cellLastHovered');
},
function() {
$(this).children('td').removeClass('cellHovered');
$(this).children('td:first').removeClass('cellFirstHovered');
$(this).children('td:last').removeClass('cellLastHovered');
});
【问题讨论】:
标签: jquery css row border css-tables