Page 1 sur 1

pb dimensions tableaux

Posté : 25 sept. 2008, 19:30
par Invité
Bonjour à tous,

j'utilise une boucle php pour générer une liste d'items (texte + image) à partir de données sql.
Mon problème est le html généré. J'essaye d'obtenir quelquechose d'uniforme mais ça ne marche pas.

Mes tableaux html ont des tailles différentes en fonction de la longueur du texte, que je n'arrive pas à rendre fixe.

Voyez vous d'ou ça peut venir?
Pour voir le pb:
Cliquez ici

Mon html (dans une boucle, pour générer autant de tableaux qu'il y a d'items):
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
<tr><td align='center'>

<?php
	foreach ($elts as $elt)
	{	
?>		
		<table border='0' cellpadding='0' width='300' cellspacing='10' style='border: solid 1px #eaeaea; border-collapse:collapse;'>
		<tr>
		<td align='left'><span style='font-size: 15px; font-weight: bold;'>{titre}</span></td>
		<td align='right' width='10%'>
		<a href='{url}'>	
		<img src='images/stories/teambuilding_thumbs/{image}' style='border: solid 1px #eaeaea;'></a></td>
		</tr>
		<tr>
		<td colspan='2' height='60' valign='top'>{texte_intro}</td>
		</tr>
		<tr>
		<td colspan='2' height='10'>
		<a href='{url}' class='readon'>Read more...</a></td>
		</tr>
		</table>
		if ($i%2 == 0) 
		{
			echo "</td></tr><tr><td>";	
		}
		else 
		{
			echo "</td><td>";			
		}
		$i++;

	}

</td></tr>
</table>
<?php
}
?>
Merci pour vos réponses.

Posté : 30 sept. 2008, 15:10
par dogmongo
Bonjour,

remplace

Code : Tout sélectionner

<table border='0' cellpadding='0' width='300' cellspacing='10' style='border: solid 1px #eaeaea; border-collapse:collapse;'>
par

Code : Tout sélectionner

<table style='width:300; height: 250; padding:10; border: solid 1px #eaeaea; border-collapse:collapse;'>
modifis height en fonction de tes besoins, le problème c'est que tu va avoir des gros blanc dans tes paragraphes si tu n'as pas assez de texte