【发布时间】:2011-12-11 15:55:50
【问题描述】:
我有一个非常简单的表格:
<table border="1" class="my-table">
<tr class="head">
<th>head-1</th>
<th>head-2</th>
<th>head-3</th>
<th>head-4</th>
<th>head-5</th>
</tr>
<tr>
<div class="row-data">
<td>data-1</td>
<td>data-2</td>
<td>data-3</td>
<td>data-4</td>
<td>data-5</td>
</div>
</tr>
</table>
正如您在上面看到的,第二行 <tr> 包含一个 <div> 然后包含 <td>s ,我这样做的原因是 我想要一个具有 border-radius 每行的css功能而不是每列的行背景(<td>)
(我知道如果我把<div> 放在<td> 里面,下面的css 就会生效,但这不是我想要的see here,它是基于列的边框半径背景,但是我需要基于行的背景。)
我的css:
.row-data{
background-color:#ececec;
border-radius:10px;
-webkit-border-radius:10px;
-moz-border-radius:10px;
}
但是以这种方式具有基于 row<tr> 的 border-radius css 功能是行不通的,如何摆脱它?
你可以在jsfiddle here上运行我的代码
【问题讨论】:
-
a
div作为tr的子级无效的html -
@Sotiris,我同意你的观点,我这样做只是为了强调我想要实现的目标,即基于行的背景具有边框半径,而不是基于列的
。跨度> 罗布是对的。这有帮助吗? stackoverflow.com/questions/1407371/…