I have a while loop that displays result from a MySQL query. I know how to change the output for the last row or an odd row but how can I change the output for the last two results?
For example I have a list of results in a 2x2 matrix with border-bottom: 1px on each result but I would like to display the bottom two without the border?
If you can use css3, it´s easy (I´ll use a list for the example):
li:nth-last-child(-n+2)
selects the last two li's.
If you want to do it in php, you can count the number of results, add a counter in your loop and add a class to the last two items.
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