Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change specific div, nth-child?

I have a problem here. I have this div that's mentioned 4 times in my code, like:

<div class='box1'>
Hello 1
</div>
<div class='box1'>
Hello 2
</div>
<div class='box1'>
Hello 3
</div>
<div class='box1'>
Hello 4
</div>

and I want to do some changes to this div class, but only the last one. I cant get the nth-class to work, it seems that i need to make a ul table for it to work? Can I get a workaround somewhere in the CSS and make it work without having to rewrite my code?

like image 915
Kim Kakan Andersson Avatar asked Jan 21 '13 23:01

Kim Kakan Andersson


1 Answers

You should be able to do this with the nth-child pseudo class. Take a look at this demo: http://jsfiddle.net/m7uW7/2/

like image 134
Sheixt Avatar answered Sep 23 '22 14:09

Sheixt