是否可能以某种方式在表行周围有一个边框? [英] Is it possible to have a border around a table row in some way?

查看:179
本文介绍了是否可能以某种方式在表行周围有一个边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在特定表格行周围添加边框,当鼠标进入行时,会更改其颜色。但是,除非使用 border-collapse:collapse; ,我看不到边框,但我必须避免边框折叠,因为在某些情况下边框可见左,右和底部但不在上面(可能是因为我使用边框折叠时不能有填充/边距)。

I'm trying to add borders around specific table rows which change it's colors when the mouse enters the row. However, I dont see a border at all unless using border-collapse:collapse; but I have to avoid border-collapse, since in some cases the border is visible left, right and at bottom but not on top (probably because I cannot have padding/margin when using border-collapse).

有办法实现这一点吗?

<table style="border-collapse:collapse;">
  <tr style="border:1px solid black">
    <td>Cell_1</td>
    <td>Cell_2</td>
  </tr>
</table>


推荐答案

您可以尝试使用 outline

tr:hover {
    outline: 1px solid #999;
}

看看: http://jsfiddle.net/dWWkx/3/

这篇关于是否可能以某种方式在表行周围有一个边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆