tabella - html table
Altezza massima nella tabella Html (3)
Avvolgi la tabella in un tag div e imposta l'altezza del div su 800px con un overflow impostato su auto.
<div style="height:800px; overflow:auto;">
//Table goes here
</div>
Quindi se l'altezza del tuo tavolo è superiore a 800 px, apparirà una barra di scorrimento nel div e ti permetterà di scorrere la tabella.
Creo un tavolo e voglio che l' height
sia di 800px
.
Se è overflow, voglio fare Scroll Bar ma i titoli non scorrono.
Quindi provo ad aggiungere questo CSS:
overflow: scroll;
max-height:800px;
Ma non è lavoro per me. Questo è l'intero file html. Qual è il problema?
CSS
table{
overflow: scroll;
text-align: center;
margin: auto;
max-height:800px;
}
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
E HTML
<table >
<tr>
<th>field a</th>
<th>field b</th>
<th>field c</th>
<th>field e</th>
</tr>
<tr>
<td>3534534</td>
<td>עו"ש</td>
<td>6,463</td>
<td>4,000</td>
</tr>
<tr>
<td>3534534</td>
<td>עו"ש</td>
<td>6,463</td>
<td>4,000</td>
</tr>
</table>
Grazie!!!
Ecco un approccio.
Aggiungi un div wrapping con CSS:
#set-height {
display: inline-block;
height:800px;
overflow: scroll;
}
Fiddle: http://jsfiddle.net/JmLFz/
Usa un altro elemento per avvolgere l'intera tabella e dargli quelle proprietà:
#table-limiter {
max-height:800px;
overflow: scroll;
}
Esempio HTML:
<div id="table-limiter">
<table>
...
</table>
</div>
Lo styling table è, a volte, un problema :(