<col>, element <col> mempunyai definisi sebagai penentu style sebuah kolom pada element <table>. Penulisan element <col> dibbungkus oleh element <colgroup>HTML
<col> ditulis didalam element <table> setelah element <caption> jika ada, dan sebelum element <thead>, <tbody>, <tfoot> dan <tr>.
Atribut HTML <col>:
| Attibute | Value | Deskripsi |
|---|---|---|
| span | angka | Menentukan jumlah kolom yang harus dijangkau |
Contoh penerapan html <col> pada HTML :
<table>
<caption>Judul Table</caption>
<colgroup>
<col style="background: #b1f5e5;">
<col style="background: #7c65fb;">
<col style="background: #e0f3b4;">
<col span="3" style="background: #dedede;">
</colgroup>
<thead>
<tr>
<th>No</th>
<th>title</th>
<th>title</th>
<th>title</th>
<th>title</th>
<th>title</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
</tr>
<tr>
<td>2</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
</tr>
<tr>
<td>3</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
<td>isi konten</td>
</tr>
</tbody>
</table>
Standar CSS yang di gunakan pada html <col>
Browser yang support dengan elemen
<col> biasanya mempunyai nilai default:
col {
display: table-column;
}
Global Atribut
Element
<col> mencakup Global Attributes HTML.
Event Attributes:
Element
<col> mencakup Event Attributes HTML.
Browser Support:
Browser yang mendukung element <col>Desktop
| Chrome | Ya |
|---|---|
| Safari | Ya |
| Firefox | 1 |
| Opera | Ya |
| IE | Ya |
| Edge | Ya |
Mobile
| Android Webview | Ya |
|---|---|
| Chrome Android | Ya |
| Edge Mobile | Ya |
| Firefox Android | 4 |
| Opera Android | Ya |
| iOs Safari | Ya |
| Samsung Internet | Ya |