HTML table avec scroll: case change de taille
marcelo44
Messages postés
345
Statut
Membre
-
notobe Messages postés 2222 Statut Membre -
notobe Messages postés 2222 Statut Membre -
Bonjour,
n'étant pas aguerri de l'html je me porte à quelques difficultés j'ai enfin réussi à faire un tableau avec scroll verticale en gardant les th fixes mais mon problème est que lorsqu'il n'y a qu'une seule entrée par exemple, elle prend la taille maximum du scroll
mon tableau :
<table border ="1">
<caption>EXERCICE n<?echo $signe.$exo?></caption>
<thead>
<tr>
<th>Heure</th>
<th>Niveau</th>
<th>Vitesse</th>
<th>Point</th>
<th>Faute</th>
<th>Abandon</th>
<th>Nombre de question</th>
<th>Note</th>
</tr>
</thead>
<tbody class="scroll">
<?
while ($Ligne = mysql_fetch_array($Resultat, MYSQL_BOTH))
{
?><tr><td align="center"><?echo $Ligne['Heure'] ;?></td>
<td align="center"><?echo $Ligne['Niveau'] ;?></td>
<td align="center"><?echo $Ligne['Niveau_Temps'] ;?></td>
<td align="center"><?echo $Ligne['Bonne_Reponse'];?></td>
<td align="center"><?echo $Ligne['Mauvaise_Reponse'] ;?></td>
<td align="center"><?echo $Ligne['Abandon'];?></td>
<td align="center"><?echo $Ligne['Nombre_Question'] ;?></td>
<td><?echo $note;?></td></tr>
<?
}
?>
</tbody>
</td></tr>
</table>
Mon css :
.scroll
{
height: 300px;
overflow-y: auto;
overflow-x: hidden
}
n'étant pas aguerri de l'html je me porte à quelques difficultés j'ai enfin réussi à faire un tableau avec scroll verticale en gardant les th fixes mais mon problème est que lorsqu'il n'y a qu'une seule entrée par exemple, elle prend la taille maximum du scroll
mon tableau :
<table border ="1">
<caption>EXERCICE n<?echo $signe.$exo?></caption>
<thead>
<tr>
<th>Heure</th>
<th>Niveau</th>
<th>Vitesse</th>
<th>Point</th>
<th>Faute</th>
<th>Abandon</th>
<th>Nombre de question</th>
<th>Note</th>
</tr>
</thead>
<tbody class="scroll">
<?
while ($Ligne = mysql_fetch_array($Resultat, MYSQL_BOTH))
{
?><tr><td align="center"><?echo $Ligne['Heure'] ;?></td>
<td align="center"><?echo $Ligne['Niveau'] ;?></td>
<td align="center"><?echo $Ligne['Niveau_Temps'] ;?></td>
<td align="center"><?echo $Ligne['Bonne_Reponse'];?></td>
<td align="center"><?echo $Ligne['Mauvaise_Reponse'] ;?></td>
<td align="center"><?echo $Ligne['Abandon'];?></td>
<td align="center"><?echo $Ligne['Nombre_Question'] ;?></td>
<td><?echo $note;?></td></tr>
<?
}
?>
</tbody>
</td></tr>
</table>
Mon css :
.scroll
{
height: 300px;
overflow-y: auto;
overflow-x: hidden
}
10 réponses
-
c'est normal, ton tbody a comme classe scroll dans laquelle tu fixes le height à 300px...
-
ah ouais... mais alors comment donner la taille max avant d'avoir accès à la scrollbar?
-
-
Bon j'ai bien mon tableau qui scroll mais je ne vois pas comment donner la taille de la scrollbar sans affecter la taille du tbody en tout cas avec la méthode que j'utilise....?
-
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question -
Min-height, max-height : https://www.zonecss.fr/proprietes-css/min-height-css.html
-
j'ai du mal à voir comment l'utiliser en l'appliquant sur le <tbody> je ne pense pas que sa me servira c'est plutôt sur le <tr> non? mais à vrai dire j'y arrive pas tout simplement...
-
-
-
-