type
Post
status
Published
date
Jul 18, 2023
slug
summary
让表格无痛支持圆角
tags
category
icon
password
📝让表格支持圆角
代码
html
<table> <thead> <tr> <th>表头1</th> <th>表头2</th> <th>表头3</th> </tr> </thead> <tbody> <tr> <td>内容1</td> <td>内容2</td> <td>内容3</td> </tr> <tr> <td>内容1</td> <td>内容2</td> <td>内容3</td> </tr> <tr> <td>内容1</td> <td>内容2</td> <td>内容3</td> </tr> </tbody> </table>
css
table { border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; word-break: break-word; } th, td { padding: 6px 16px; border: 1px solid rgba(0, 0, 0, 4%); } th { border-right-width: 0; &:first-child { border-top-left-radius: 8px; } &:last-child { border-top-right-radius: 8px; border-right-width: 1px; } } td { color: rgba(0, 0, 0, 85%); border-width: 0 0 1px 1px; &:last-child { border-right-width: 1px; } } tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; } tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
致谢:
有关表格圆角的问题,欢迎您在底部评论区留言,一起交流~
- 作者:Marco
- 链接:https://hbuecx.com/article/edcda2b6-69e3-4264-b3c3-9dd91159d733
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。


