Proprietà CSS table-layout
Esempio
Imposta diversi algoritmi di layout della tabella:
table.a {
table-layout: auto;
width: 180px;
}
table.b {
table-layout:
fixed;
width: 180px;
}
Definizione e utilizzo
La table-layout
proprietà definisce l'algoritmo utilizzato per disporre le celle, le righe e le colonne della tabella.
Suggerimento: il principale vantaggio del layout della tabella: fisso; è che la tabella rende molto più veloce. Su tabelle di grandi dimensioni, gli utenti non vedranno alcuna parte della tabella finché il browser non avrà eseguito il rendering dell'intera tabella. Quindi, se usi table-layout: fixed, gli utenti vedranno la parte superiore della tabella mentre il browser carica ed esegue il rendering del resto della tabella. Questo dà l'impressione che la pagina si carichi molto più velocemente!
Valore di default: | auto |
---|---|
Ereditato: | no |
Animabile: | no. Leggi su animabile |
Versione: | CSS2 |
sintassi JavaScript: | oggetto .style.tableLayout="fisso" |
Supporto browser
I numeri nella tabella specificano la prima versione del browser che supporta completamente la proprietà.
Property | |||||
---|---|---|---|---|---|
table-layout | 14.0 | 5.0 | 1.0 | 1.0 | 7.0 |
Sintassi CSS
table-layout: auto|fixed|initial|inherit;
Valori di proprietà
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 |
Pagine correlate
Tutorial CSS: Tabella CSS
Riferimento HTML DOM: proprietà tableLayout