English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML: <col> align property

The align property specifies the horizontal alignment of the content related to the <col> element, the <col> tag specifies column properties for each column within the <colgroup> element, and the <col> tag is very useful for applying styles to the entire column, rather than repeating the style for each cell in each row.

 HTML <col> علامة

Online Example

Use the <colgroup> and <col> tags to set the background color of three columns:

!DOCTYPE html
<html>
<head>
<meta charset="utf-8">
<title>HTML <col> align property usage - Basic Tutorial (oldtoolbag.com)</title>
<style>table, th, td {  border: 1px solid black;}</style>
</head>
<body>
<table>
  <colgroup>
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
  <tr>
    <td>5869207</td>
    <td>My first CSS</td>
    <td>$49</td>
  </tr>
</table>
</body>
</html>
اختبار الرؤية ‹/›

تطابق المتصفحات

IEFirefoxOperaChromeSafari

يدعم Opera و Internet Explorer 8 وأولى إصدارات IE الخاصية align فقط (لا يدعمها IE9).

التعريف والاستخدام

HTML5 لا يدعم خاصية align لـ <col>.

خصائص align تحدد طريقة التوجيه الأفقية للمحتوى المتعلق بـ col.

علامة <col> تحدد خصائص العمود لكل عمود داخل علامة <colgroup>.

علامة <col> مفيدة جدًا ل تطبيق النمط على كل عمود كامل، بدلاً من تكرار النمط لكل خلية في كل سطر.

النحو

<col align="left|right|center|justify|char">

قيمة الخاصية

القيمةالوصف
leftتوجيه المحتوى إلى اليسار (القيمة الافتراضية).
rightتوجيه المحتوى إلى اليمين.
centerتوجيه المحتوى إلى الوسط (القيمة الافتراضية لـ th).
justifyتمدد السطر، حتى يمكن أن يكون كل سطر طولاً متساوياً (مثل في الصحف والمجلات).
حرفتعديل المحتوى لتناسب الحرف المحدد.
 HTML <col> علامة