css设置table圆角边框不起作用的原因是:属性border-collapse:collapse和属性border-radius不兼容。正确方法如【border-collapse: separate;border-spacing:0】。
本文环境:windows10、css3,本文适用于所有品牌的电脑。
原因分析:
在table中设置border-radius发现不起作用,原因是border-collapse:collapse和border-radius不兼容。
(学习视频分享:css视频教程)
css:
border-collapse: separate; border-spacing: 0;
代码实现:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> #table_wrap > table { font-size: 16px; text-align: center; margin: 0 auto; border-collapse: separate; border-spacing: 0; border: 2px #000; } table thead tr,table tbody tr { height: 50px; line-height: 50px; /*background-color: pink;*/ } table tr th:first-child,table tr td:first-child {/*设置table左边边框*/ border-left: 2px solid #eaeaea; } table tr th:last-child,table tr td:last-child {/*设置table右边边框*/ border-right: 2px solid #eaeaea; } table tr td:first-child, table tr td:nth-child(2), table tr td:nth-child(3), table tr td:last-child{/*设置table表格每列底部边框*/ border-bottom: 2px solid #eaeaea; } /*table tr:last-child td:first-child, table tr:last-child td:nth-child(2), table tr:last-child td:nth-child(3), table tr:last-child td:last-child{/!*设置table表格最后一列底部边框*!/ border-bottom: 2px solid #000; }*/ table tr th { background: #eaeaea; } table tr:first-child th:first-child { border-top-left-radius: 12px; } table tr:first-child th:last-child { border-top-right-radius: 12px; } table tr:last-child td:first-child { border-bottom-left-radius: 12px; } table tr:last-child td:last-child { border-bottom-right-radius: 12px; } </style> </head> <body> <div id="table_wrap"> <table width="800" cellspacing="0" cellpadding="0"> <thead> <tr> <th>头部1</th> <th>头部2</th> <th>头部3</th> <th>头部4</th> </tr> </thead> <tbody> <tr> <td>1内容1</td> <td>1内容2</td> <td>1内容3</td> <td>1内容4</td> </tr> <tr> <td>2内容1</td> <td>2内容2</td> <td>2内容3</td> <td>2内容4</td> </tr> <tr> <td>3内容1</td> <td>3内容2</td> <td>3内容3</td> <td>3内容4</td> </tr> </tbody> </table> </div> </body> </html>
实现效果:
相关推荐:CSS教程
以上是css设置table圆角边框不起作用是什么原因的详细内容。更多信息请关注PHP中文网其他相关文章!
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

我假设你们中的大多数人已经听说过盖茨比,至少很松散地知道,这基本上是一个用于React站点的静态站点生成器。通常


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章
刺客信条阴影:贝壳谜语解决方案
3 周前ByDDD
Windows 11 KB5054979中的新功能以及如何解决更新问题
2 周前ByDDD
在哪里可以找到原子中的起重机控制钥匙卡
3 周前ByDDD
节省R.E.P.O.解释(并保存文件)
1 个月前By尊渡假赌尊渡假赌尊渡假赌
刺客信条阴影 - 如何找到铁匠,解锁武器和装甲定制
4 周前ByDDD

热工具

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

SublimeText3汉化版
中文版,非常好用

Dreamweaver Mac版
视觉化网页开发工具

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器