ich diese Tabelle CSS haben:Wie Farbe in der ersten td in meiner Tabelle ändern Klasse mit
table.show-my-request-table {
border: 1px solid black;
margin-left:auto;
margin-right:auto;
border-collapse: collapse;
}
tr.show-my-request-table-header{
border: 1px solid black;
}
tr.show-my-request-table{
border: 1px solid black;
}
tr.show-my-request-table:hover{
background-color: #D3D3D3;
}
Und Tabelle HTML:
<table class="show-my-request-table center">
<tr class="show-my-request-table-header">
<th>Date</th>
<th>Priority</th>
<th>Question</th>
</tr>
<tr >
<td class="show-my-request-table"> 11.8.2016 15:27:13
</td>
<td>
<img src="/resources/img/priority-flag/priority-LOW-icon.png" class="priority-icon">
</td>
<td>
</td>
</tr>
<tr >
<td class="show-my-request-table">
11.8.2016 14:45:41
</td>
<td>
<img src="/resources/img/priority-flag/priority-LOW-icon.png" class="priority-icon">
</td>
<td>
Jak se máš?
</td>
</tr>
</table>
Ich möchte einen roten Hintergrund für die erste td
einrichten Etikett.
Mein Problem ist, dass ich nicht weiß, wie es für nur einen Tisch zu tun ist.
Wenn ich versuche:
td:first-child {
background-color: #ff0000;
}
es für alle Tabellen funktioniert.
Ich denke, dass dieser Code gut, aber nicht funktioniert:
table.show-my-request-table > td:first-child {
background-color: #ff0000;
}
Warum? Wie kann ich das machen?
Arbeit nett, danke. –