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中文網其他相關文章!

在本週的Web平台新聞世界中,Google搜索控制台可以更輕鬆地查看爬行的標記,我們了解到自定義屬性

在本週的新聞中,Wikipedia有助於識別三個慢單擊處理程序,Google Earth進入網絡,CSS中的SVG屬性獲得了更多的支持,以及在殭屍cookies的情況下該怎麼做。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

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

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

Atom編輯器mac版下載
最受歡迎的的開源編輯器

禪工作室 13.0.1
強大的PHP整合開發環境