Brad
Brad

Reputation: 331

Increasing indent/margin for each li in a list?

Is there an easy/elegant way in which to increasingly indent something using CSS?

Example, ul with five li and each one is 1 EM indented more than the one just above it? It seems like nth child could help but I'd like to keep support for IE8.

I know that I could assign IDs to each li but that doesn't seem very efficient...

Thanks!

Upvotes: 2

Views: 262

Answers (1)

Madara's Ghost
Madara's Ghost

Reputation: 174957

No, that can't be done with CSS alone cleanly.

You'll have to leverage JavaScript, loop through the lis and calculate the indentation for each.

Upvotes: 2

Related Questions