css - LESS mix-in for nth-child? -
i'm trying make less mixin give me output:
.resource:nth-child(8n+1) { clear: left; }
i've got far:
.wrap-every(@n) { &:nth-child(@n + "n+1") { // parse error on line clear: left; } } .resource { .wrap-every(8); }
but it's giving parse error on indicated line
parseerror: unrecognised input
is there way this?
less >= 1.4
you this:
.wrap-every(@n) { &:nth-child(@{n}n + 1) { clear: left; } }
this should have desired output. without hacks needed.
in older versins of less
you can try simple string interpolation:
.wrap-every(@n) { @t: ~":nth-child(@{n}n + 1)"; &@{t} { clear: left; } }
and output css in both cases should this:
.resource:nth-child(8n + 1) { clear: left; }
Comments
Post a Comment