centrer le texte des cellules qui viennent d'une base de données dans un tableau

Répondre
alexandryne
le 04/03/2012 à 19:34
alexandryne
Bonsoir,

Je n'arrive pas à centrer le texte des cellules qui viennent de la base de données dans mon tableau. Pour l'instant tout est à gauche. Merci. Mon code, c'est :
  1. <?php <html>
  2. <body>
  3. <table border="1" style="border-collapse: collapse" width=100%">
  4. <thead>
  5. <tr>
  6. <th width=12,5%" bgcolor=#FFCCFF>Date</th>
  7. <th width=12,5%" bgcolor=#FFCCFF>Partenaire</th>
  8. <th width=12,5%" bgcolor=#FFCCFF>Achat</th>
  9. <th width=12,5%" bgcolor=#FFCCFF>Pourcentage</th>
  10. <th width=12,5%" bgcolor=#FFCCFF>Attente</th>
  11. <th width=12,5%" bgcolor=#FFCCFF>Validation</th>
  12. <th width=12,5%" bgcolor=#FFCCFF>Paiement</th>
  13. <th width=12,5%" bgcolor=#FFCCFF>Date</th>

  14. </tr>
  15. </thead>
  16. <tbody>
  17. <tr>
  18. <td><?php echo stripslashes($data[ 'date_achat']); ?></td>
  19. <td><?php echo stripslashes($data[ 'partenaire']); ?></td>
  20. <td><?php echo stripslashes($data[ 'montant_achat']); ?></td>
  21. <td><?php echo stripslashes($data[ 'pourcentage']); ?></td>
  22. <td><?php echo stripslashes($data[ 'montant_attente']); ?></td>
  23. <td><?php echo stripslashes($data[ 'montant_valide']); ?></td>
  24. <td><?php echo stripslashes($data[ 'montant_paye']); ?></td>
  25. <td><?php echo stripslashes($data[ 'date_paiement']); ?></td>
  26. </tr>
  27. </tbody>

  28. </table>?>
ploupy
le 07/03/2012 à 14:44
ploupy
par exemple, prenons une de tes célulles :

  1. <td>
  2. <?php echo stripslashes($data[ 'date_achat']); ?>
  3. </td>


tu rajoute <p align="center"> :
  1. <td>
  2. <p align="center">
  3. <?php echo stripslashes($data[ 'date_achat']); ?>
  4. </td>



voila, mais tu demande dans la mauvaise section, c'est un problème html et non php ou sql
alexandryne
le 08/03/2012 à 09:45
alexandryne
Bonjour,

Merci pour ta réponse. C'est bien centré, mais par contre, ça m'a augmenté la hauteur de la cellule. Au lieu de faire une ligne, ça en fait 3 et le texte est centré en largeur et en hauteur. Je voudrais juste que ce soit centré en largeur. Y-a-il une solution ? Merci.
jackbocar
le 15/03/2012 à 18:28
jackbocar
Tu peux essayer à la place de <p align="center">

ou un <span align="center">

ou mieux un <div align="center">

Jack Bocar
Répondre

Ecrire un message

Votre message vient d'être créé avec succès.
LoadingChargement en cours