如何在 HTML 中建立表格邊框?
在 HTML 中建立表格邊框,使用了 border 屬性。但 HTML5 的引入棄用了 border 標籤。使用 CSS 屬性 border 建立表格邊框。設定表格邊框以及 <th> 和 <td> 的邊框。
示例
你可以嘗試執行以下程式碼來在 HTML 中建立一個邊框表格。這裡我們使用 <style> 標籤
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h1>Employee Details</h1> <table> <tr> <th>Name</th> <td>Amit</td> <td>Sachin</td> </tr> <tr> <th>Age</th> <td>27</td> <td>34</td> </tr> </table> </body> </html>
輸出
廣告