English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
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 | تمدد السطر، حتى يمكن أن يكون كل سطر طولاً متساوياً (مثل في الصحف والمجلات). |
حرف | تعديل المحتوى لتناسب الحرف المحدد. |