1

I have the ng-repeat directive on my div <div ng-repeat="tab in tabs" class="test"></div>

In my css I have this:

.test {margin-right:1%}
.test:nth-child(4n) {margin-right:0}

The nth-child(4n) is not working with my ng-repeat but if I manually put my div without the ng-repeat it works like a charm. (It's the same with all nth-child combination.

So what did I miss ?

EDIT: My case concerns the use of the ng-repeat combine with nth-child pseudo-element

Thank you in advance.

EDIT 2 This post is old but the problem as the last comment say, is that there is some ng-show.. It was obvious, no excuses.

KeizerBridge
  • 2,707
  • 7
  • 24
  • 37
  • possible duplicate of [nth-child doesn't respond to class](http://stackoverflow.com/questions/5428676/nth-child-doesnt-respond-to-class) – Bhojendra Rauniyar Jun 24 '15 at 10:19
  • div.test:nth-child(4n) works! – Bhojendra Rauniyar Jun 24 '15 at 10:20
  • Ok so I precise that in some case, it works well, sometimes it doesn't recognize which one is the fourth element, so the nth-child(4n) work on the second one or another. This is working well if I don't use ng-repeat. I don't know why or what may I have missed but in my case it's not working. – KeizerBridge Jun 24 '15 at 11:53
  • Could you prepare an isolated example that recreates this issue? – Tomek Sułkowski Jun 24 '15 at 12:02
  • 1
    Maybe you have some ng-show on elements in ng-repeat? So that element you think is second, is, in fact, 4th (because there are two hidden ones before it) – Sergio Tulentsev Jun 24 '15 at 12:13

0 Answers0