HTML Tutorial

عنصر <caption>

الاستخدام:

تُستخدم العلامة لتوفير تعليق توضيحي على جدول في صفحة ويب.

الخصائص:

  • align: محاذاة النص داخل التعليق.
  • valign: محاذاة التعليق رأسياً داخل الجدول.

أمثلة:

مثال 1: جدول بدون تعليق

<table>
  <thead>
    <tr>
      <th>اسم</th>
      <th>العمر</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>جون</td>
      <td>30</td>
    </tr>
  </tbody>
</table>

مثال 2: جدول مع تعليق

<table>
  <caption>بيانات الطلاب</caption>
  <thead>
    <tr>
      <th>اسم</th>
      <th>العمر</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>جون</td>
      <td>30</td>
    </tr>
  </tbody>
</table>

استكشاف العلامة <caption>

<!DOCTYPE html>
<html>
<head>
  <title>مثال العلامة Caption</title>
</head>
<body>
  <table>
    <caption>بيانات الطلاب</caption>
    <thead>
      <tr>
        <th>اسم</th>
        <th>العمر</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>جون</td>
        <td>30</td>
      </tr>
      <tr>
        <td>ماري</td>
        <td>25</td>
      </tr>
    </tbody>
  </table>
</body>
</html>

ملحوظة: لتحسين إمكانية الوصول، ضع تعليقًا توضيحيًا فريدًا ومفيدًا لكل جدول.