2 pièce(s) jointe(s)
Poids sélecteur non pris en compte sur une TABLE
Bonjour,
Je fais un tableau et je veut mettre un background-color sur ma première colonne mais c'est l'ancienne couleur qui reste alors que le poids du sélecteur de l'ancienne couleur est plus faible que la nouvelle et je ne comprends pas pourquoi sa fait cela ?
Code:
1 2 3 4 5 6 7
| td{
background-color: blueviolet; /*Ici le poid est de 0, 0, 1*/
}
.col1{
background-color: aqua; /*Et là le poid est de 0, 1, 0*/
} |
Ce qui donne :
Pièce jointe 483813
Normalement toute la 1er colonne aurait dû être en aqua.
Pour remédier à ce problème il faut que je rajoute le sélecteur tfoot :
Code:
1 2 3 4 5 6 7
| tfoot td{
background-color: blueviolet; /*Ici le poid est de 0, 0, 2*/
}
.col1{
background-color: aqua; /*Et là le poid est de 0, 1, 0*/
} |
Ce qui donne :
Pièce jointe 483819
Donc le résultat attendu ! Pourquoi le poid du sélecteur de la classe qui est plus important ne prend pas le dessus sur celui de la balise ?
Merci par avance.
Le
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="styles.css" type="text/css">
<title>First tableau</title>
</head>
<body>
<header>
<a id=linkCaseImg href="linkCaseImg" target="_blank">
<img id=linkImgSrc src="linkImgSrc" alt="Mon image" />
</a>
</header>
<nav></nav>
<section>
<article>
<table >
<caption >My Array</caption>
<colgroup >
<col class="col1"/>
<col class="col2"/>
<col class="col3"/>
<col class="col4"/>
<col class="col5"/>
<col class="col6"/>
</colgroup>
<thead>
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>Age</th>
<th>Adresse</th>
<th>Profession</th>
<th>Diplôme</th>
</tr>
</thead>
<tfoot><td colspan="6">SPOIL</td></tfoot>
<tbody>
<tr>
<td>Terminator</td>
<td>---</td>
<td>---</td>
<td>Terre</td>
<td>Tueur pro</td>
<td>---</td>
</tr>
<tr>
<td>Alien</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>Tueur pro</td>
<td>---</td>
</tr>
<tr>
<td>Dark Vador</td>
<td>Anakin</td>
<td>50</td>
<td>Super Star Destroyer</td>
<td>Bras droit de Palpatine</td>
<td>Dîplome de Jedï</td>
</tr>
<tr>
<td>Alain De Loin</td>
<td>---</td>
<td>Inconnu</td>
<td>Loin</td>
<td>Acteur</td>
<td>Néant</td>
</tr>
<tr>
<td>Jons</td>
<td>Indianas</td>
<td>70</td>
<td>Au bout du monde</td>
<td>Archéologue</td>
<td>Master Archéologie</td>
</tr>
<tr>
<td>Palpatine</td>
<td>---</td>
<td>Vieux débris</td>
<td>Etoile noir</td>
<td>Empereur</td>
<td>Bac -10</td>
</tr>
</tbody>
</table>
</article>
<aside></aside>
</section>
<section></section>
<footer></footer>
<script src="scripts.js"></script>
</body>
</html> |