I have a grid system for my site which was initially set up with a style applied to every sixth item in a grid
li:nth-child(5n+1){ margin-left:0 }
I'm in the process of making my site responsive, and I have a breakpoint where I specify
li:nth-child(3n+1){ margin-left:0 }
But the problem is that it is still interpreting the previous style of 5n+1, which I don't want. How do I tell CSS to ignore that style. Or better yet, how do I create a fluid grid so that whenever an li item is the first in a row, it has a margin-left of 0, and all others have a margin of, say, 25px?
li { margin-left: 25px;} li:first-child { margin-left: }
? – Doorstop:first-child
just addresses the first child in your html code, not in the displayed line. Did you try to reset themargin-left: 25px
for the:nth-child(5n+1)
? – Gabbey:nth-child(3n+1)
comes after the reset? – Gabbey.three-up li:nth-child(3n+1) {}
and.five-up li:nth-child(5n+1) {}
– Knockout