Properti tata letak tabel CSS
Contoh
Atur algoritma tata letak tabel yang berbeda:
table.a {
table-layout: auto;
width: 180px;
}
table.b {
table-layout:
fixed;
width: 180px;
}
Definisi dan Penggunaan
Properti table-layout
mendefinisikan algoritme yang digunakan untuk meletakkan sel tabel, baris, dan kolom.
Tip: Manfaat utama tata letak tabel: tetap; adalah bahwa tabel membuat lebih cepat. Pada tabel besar, pengguna tidak akan melihat bagian mana pun dari tabel sampai browser merender seluruh tabel. Jadi, jika Anda menggunakan tata letak tabel: tetap, pengguna akan melihat bagian atas tabel saat browser memuat dan merender tabel lainnya. Ini memberi kesan bahwa halaman dimuat lebih cepat!
Nilai bawaan: | mobil |
---|---|
Diwarisi: | tidak |
Animasi: | tidak. Baca tentang animasi |
Versi: kapan: | CSS2 |
Sintaks JavaScript: | objek .style.tableLayout="tetap" |
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Property | |||||
---|---|---|---|---|---|
table-layout | 14.0 | 5.0 | 1.0 | 1.0 | 7.0 |
Sintaks CSS
table-layout: auto|fixed|initial|inherit;
Nilai properti
Value | Description | Play it |
---|---|---|
auto | Browsers use an automatic table layout algorithm. The column width is set by the widest unbreakable content in the cells. The content will dictate the layout | |
fixed | Sets a fixed table layout algorithm. The table and column widths are set by the widths of table and col or by the width of the first row of cells. Cells in other rows do not affect column widths. If no widths are present on the first row, the column widths are divided equally across the table, regardless of content inside the cells | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Halaman Terkait
Tutorial CSS: Tabel CSS
Referensi DOM HTML: properti tableLayout