border-collapse 屬性設置table的邊框是否被合併爲一個單一的邊框,仍是像在標準的 HTML 中那樣分開顯示。css
border-collapse值html
separate: 默認值。邊框會被分開。不會忽略 border-spacing 和 empty-cells 屬性。spa
collapse : 若是可能,邊框會合併爲一個單一的邊框。會忽略 border-spacing 和 empty-cells 屬性。code
inherit : 規定應該從父元素繼承 border-collapse 屬性的值。htm
對應的JS腳本屬性爲:borderCollapse繼承
border-collapse實例ci
<!DOCTYPE html> <html> <head> <style type="text/css"> table {}{ border-collapse:collapse; } table, td, th {}{ border:1px solid black; } </style> </head> <body> <table> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td>Bill</td> <td>Gates</td> </tr> <tr> <td>Steven</td> <td>Jobs</td> </tr> </table> <p><b>註釋:</b>若是沒有規定 !DOCTYPE,border-collapse 屬性可能會引發意想不到的錯誤。</p> </body> </html>
參考資料:使用border-collapse設置table邊框 http://www.studyofnet.com/news/942.htmlget