Probably some stupid reason for it not working, but i tend to mess up the css a bit. So maybe it will apply to others aswell. CSS:
.bet_history table {
width: 1000px;
display: block;
border-collapse: collapse;
}
.bet_history td {
padding: 0;
font-size: 13px;
text-align: center;
padding-top: 1px;
padding-bottom: 1px;
background: #0361ba;
color: #BDD6CE;
}
.bet_history tr {
border-bottom: 1px solid black;
}
.bet_history tr:last-child {
background: red;
}
.bet_history td.bet_history2 {
color: #F0F0F0;
width: 650px;
}
.bet_history td.bet_history1 {
background-color: #0354a1;
color: white;
width: 100px;
cursor: pointer;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
}
.bet_history td.bet_history1:hover {
color: #3399FF;
}
And here is the HTML: Edited!
<div id="main">
admin1<br />
<table class="bet_history">
<tr><td style="width: 250px;">Bet ID: #6. 09-22-2014 16:08</td><td class="bet_history1">Match ID #6</td><td class="bet_history2"><span style="color: #00FFFF;">10000</span> minerals on Cure(2.00). Your bet returned <span style="color: #00FFFF;">0</span> minerals. Better luck next time!</td></tr><tr><td style="width: 250px;">Bet ID: #5. 09-22-2014 16:06</td><td class="bet_history1">Match ID #4</td><td class="bet_history2"><span style="color: #00FFFF;">2222</span> minerals on Snute(2.30). Your bet returned <span style="color: #00FFFF;">5110.6</span> minerals. Congratulations!</td></tr><tr><td style="width: 250px;">Bet ID: #4. 09-22-2014 15:58</td><td class="bet_history1">Match ID #4</td><td class="bet_history2"><span style="color: #00FFFF;">2222</span> minerals on Snute(2.30). Your bet returned <span style="color: #00FFFF;">5110.6</span> minerals. Congratulations!</td></tr><tr><td style="width: 250px;">Bet ID: #3. 09-22-2014 15:25</td><td class="bet_history1">Match ID #5</td><td class="bet_history2"><span style="color: #00FFFF;">600</span> minerals on Lars(4.00). Your bet returned <span style="color: #00FFFF;">2400</span> minerals. Congratulations!</td></tr><tr><td style="width: 250px;">Bet ID: #2. 09-22-2014 12:03</td><td class="bet_history1">Match ID #3</td><td class="bet_history2"><span style="color: #00FFFF;">64</span> minerals on naniwa(9.00). Your bet returned <span style="color: #00FFFF;">576</span> minerals. Congratulations!</td></tr><tr><td style="width: 250px;">Bet ID: #1. 09-20-2014 16:00</td><td class="bet_history1">Match ID #1</td><td class="bet_history2"><span style="color: #00FFFF;">20</span> minerals on Snute(2.20). Your bet returned <span style="color: #00FFFF;">44</span> minerals. Congratulations!</td></tr>
</table>
</div>
Why is the last-child not applying to the last tr? It will if i set it to td. Im sure its some stupid thing i did in the css.. This is no finished product. Im just wondering why the last-child doesnt work.
:last-child will not work if the element is not the VERY LAST element. I think it's crucial to add/emphasize that :last-child will not work if the element is not the VERY LAST element in a container.
The Last Child selector is a selector that allows the user to target the last element inside the containing element. This selector is also known as a Structural Pseudo class which means it is used for styling content on the basis of parent and child content.
The :nth-last-child(n) selector matches every element that is the nth child, regardless of type, of its parent, counting from the last child. n can be a number, a keyword, or a formula.
As @Vucko mentioned in the comments the tr:last-child
style is applied, however the td's in that row override that style.
If you want all the td's in the last row to be red edit your class to:
.bet_history tr:last-child td {
background: red;
}
FIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With