Partage
  • Partager sur Facebook
  • Partager sur Twitter

Colorer des lignes de tableau

de plusieurs couleurs

Sujet résolu
    3 novembre 2006 à 19:31:51

    Salut à tous ,

    bon alors je veux colorer des lignes de tableau (tr) de 3 couleurs differentes, il s'agit de mon forum enfaite je veux le meme effet que l'on peut voir ici sur ce forum (quand on lis les messages) :



    <table class="forum3"><tr><th width="25%">cellule 1</th><th>cellule 2</th></tr>
    (voici la ligne qui pose probl )
    <tr class="forum4"><td>cellule 3 </td>  <td>Cellule 4  </td></tr>

    <tr><td>Cellule 5  </td><td>Cellule 6 </td></tr></table>



    le css :


    table.forum3
    {
       border-collapse: collapse;
       text-align: center;
       margin: auto;
       width:600px;
    }
    table.forum3 th
    { 
       color: white;
     background-color: #dc9600 ;
     border: 1px solid #dc9600;
     text-align: center;
    }
    table.forum3 td
    {
       text-align: left;
       background-color: #e9a600 ;
       border: 2px solid #dc9600;
       color: white;

    }

    table.forum4
    {
       border-collapse: collapse;
       text-align: center;
       margin: auto;
       width:600px;
    }
    table.forum4 th
    { 
     color: white;
     border: 1px solid #dc9600;
     text-align: center;
    background-color: #e09900;
    }
    table.forum4 td
    {
       text-align: left;
       background-color: #e9a600 ;
       border: 2px solid #dc9600;
       color: white;

    }







    Voila pour toute la classe forum 3 j'ai aucun probleme les 2 couleurs s'affichent bien , mais pour la classe forum 4 non , il n'affiche pas

    merci de m'aider :)
    • Partager sur Facebook
    • Partager sur Twitter
      3 novembre 2006 à 20:14:56

      Essaie avec un !important
      • Partager sur Facebook
      • Partager sur Twitter
        4 novembre 2006 à 13:36:45

        Non, en fait ta classe n'appartient pas à une table, mais à un tr.

        Donc :

        tr.forum4
        {
           text-align: center;
           width:600px;
        }
        tr.forum4 th
        {
         color: white;
         border: 1px solid #dc9600;
         text-align: center;
         background-color: #e09900 !important;
        }
        tr.forum4 td
        {
           text-align: left;
           background-color: #e9a600 !important;
           border: 2px solid #dc9600;
           color: white;

        }
        • Partager sur Facebook
        • Partager sur Twitter
          4 novembre 2006 à 14:15:26

          çà ne marche pas :(



          tr.forum4
          {
             text-align: center;
             width:600px;
          }
          tr.forum4 th
          {
           color: white;
           border: 1px solid #dc9600;
           text-align: center;
           background-color: #e09900 !important;
          }
          tr.forum4 td
          {
             text-align: left;
             background-color: white !important;
             border: 2px solid #dc9600;
             color: white;

          }







          <table class="forum3"><tr><th width="25%">cellule 1</th><th>cellule 2</th></tr>

          <tr class="forum4"><td>cellule 3 </td>  <td>Cellule 4  </td></tr>

          <tr><td>Cellule 5  </td><td>Cellule 6 </td></tr></table>



          • Partager sur Facebook
          • Partager sur Twitter
            4 novembre 2006 à 14:22:31

            Avec les tableaux, il y a souvent des problèmes avec les priorités d'héritage, regarde avec IE pour voir si ça fonctionne, lui il s'en fout complètement de l'héritage :D

            Essaye de cette façon :

            table.forum3 tr.forum4
            {
               text-align: center;
               width:600px;
            }
            table.forum3 tr.forum4 th
            {
             color: white;
             border: 1px solid #dc9600;
             text-align: center;
             background-color: #e09900 !important;
            }
            table.forum3 tr.forum4 td
            {
               text-align: left;
               background-color: white !important;
               border: 2px solid #dc9600;
               color: white;

            }


            Si ça ne fonctionne toujours pas, là je sais plus :euh:
            • Partager sur Facebook
            • Partager sur Twitter
              4 novembre 2006 à 14:38:06

              je suis un gross chanceux puisque çà marche :D
              sur tous les navigateurs

              merci beaucoup man de ta patience
              • Partager sur Facebook
              • Partager sur Twitter

              Colorer des lignes de tableau

              × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
              × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
              • Editeur
              • Markdown