【发布时间】:2016-02-06 11:56:55
【问题描述】:
我正在尝试创建一个表格并在 HOVER 上折叠标题元素的边框,而表格的其余部分保持不变。如果我在整个桌子上尝试它会起作用,但当我只在th 上尝试时它不会。我究竟做错了什么?
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<style>
table
{
border:3px solid black;
}
tr{
background: #FFFF66;
}
td{
border:1px solid red;
}
th{
border:2px solid blue;
transition:transform 2s;
}
table:hover th{
border-collapse: collapse;
transform: rotate(360deg);
}
</style>
</head>
<body>
<h2>Most Watched Shows:</h2>
<table width="70%">
<tr>
<th>Top 5</th>
<th>6-10</th>
</tr>
<tr>
<td>1.<a style=color:blue href="http://www.imdb.com/title/tt1520211/?ref_=nv_sr_1">The Walking Dead</a></td>
<td>6.<a style=color:blue href="http://www.imdb.com/title/tt2661044/?ref_=nv_sr_1">The 100</a></td>
</tr>
<tr>
<td>2.<a style=color:blue href="http://www.imdb.com/title/tt0460681/?ref_=nv_sr_1">Supernatural</a></td>
<td>7.<a style=color:blue href="http://www.imdb.com/title/tt2193021/?ref_=nv_sr_1">Arrow</a></td>
</tr>
<tr>
<td>3.<a style=color:blue href="http://www.imdb.com/title/tt0773262/?ref_=nv_sr_1">Dexter</a></td>
<td>8.<a style=color:blue href="http://www.imdb.com/title/tt1632701/?ref_=nv_sr_1">Suits</a></td>
</tr>
<tr>
<td>4.<a style=color:blue href="http://www.imdb.com/title/tt0944947/?ref_=nv_sr_1">Game of Thrones</a></td>
<td>9.<a style=color:blue href="http://www.imdb.com/title/tt2017109/?ref_=nv_sr_1">Banshee</a></td>
</tr>
<tr>
<td>5.<a style=color:blue href="http://www.imdb.com/title/tt0412142/?ref_=nv_sr_2">House MD</a></td>
<td>10.<a style=color:blue href="http://www.imdb.com/title/tt0903747/?ref_=nv_sr_3">Breaking Bad</a></td>
</tr>
</table>
</body>
</html>
【问题讨论】:
-
您的浏览器版本是多少?
-
我使用谷歌浏览器。我想我得到了最新版本 46.0.2490.80 m
-
你检查了上面的链接吗?
-
我知道旋转有效....问题在于边框折叠。还是分开的
标签: css hover border html-table collapse