我想渲染一个React表,它没有边界,但有圆角边缘。我尝试使用border-collapse: collapse
,它删除了表格中列之间出现的边框,但它也删除了我设置的border-radius属性。有没有人有一个想法,如何做到这一点?带有圆边的边框塌陷?
这是我如何造型的表格。注意我没有在任何地方指定边框,但它们仍然出现。
moduleSection {
border-radius: 4px;
background-color: #fff;
}
这里是我如何在我的JS文件创建表:
renderRow = (item) => {
return (
<tr key={item.id}>
<td>
{item.name}
</td>
<td>
<div>
{item.status}
</div>
</td>
</tr>
);
}
render() {
const items = this.props.items;
return (
<table className={styles.moduleSection}>
<thead>
<tr>
<th>
<div>
Your Items
</div>
</th>
<th>
<div>
Item Status
</div>
</th>
</tr>
</thead>
<tbody>{items.map(this.renderRow)}</tbody>
</table>
);
}
尝试将边框宽度设置为0. –
嗯,没有运气:( – user3802348