ใน HTML5 ไม่รองรับ attribute border ของ <table> แล้ว ต้องใช้ CSS property border แทน กำหนดให้ table, th, td ทั้งหมด
วิธีการ
table, th, td {
border: 1px solid black;
}
ตัวอย่างเต็ม
<!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>
รูปแบบขอบที่นิยม
border: 1px solid #ddd- ขอบบางสีเทาอ่อน (clean)border: 2px solid #333- ขอบหนาสีเข้มborder-collapse: collapse- รวมขอบ (แนะนำ)
ข้อควรทราบ
ต้องกำหนด border ให้ table, th, td ครบทุกตัว ไม่เช่นนั้นขอบจะไม่ต่อเนื่อง