Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

วิธีเพิ่ม Table Caption (คำอธิบายตาราง) ใน HTML

ใช้แท็ก <caption> ภายใน <table> เพื่อเพิ่มคำอธิบายหัวข้อตาราง

ตัวอย่าง

<!DOCTYPE html>
<html>
  <head>
    <style>
      table, th, td { border: 1px solid black; }
    </style>
  </head>
  <body>
    <h2>Cricketers</h2>
    <table style="width:100%">
      <caption>Indian Cricketers</caption>
      <th>Name</th>
      <tr>
        <td>Sachin Tendulkar</td>
      </tr>
      <tr>
        <td>Virat Kohli</td>
      </tr>
    </table>
  </body>
</html>