开发者

Possible to reverse the layering of items in an unordered list using CSS?

开发者 https://www.devze.com 2023-03-26 14:58 出处:网络
I have a collection of items in an unordered list that overlap each other.My issue is that I need the first item to have the highest z-index and then go down from there.I can do this manually by setti

I have a collection of items in an unordered list that overlap each other. My issue is that I need the first item to have the highest z-index and then go down from there. I can do this manually by setting the z-index:

http://jsfiddle.net/dp9YD/7/

But I would like to do this without manually setting each z-index (not sure if this is possible). Right now If i don't use the z-index it renders like this:

http://jsfiddle.net/dp9YD/8/

With items that come later in the list being on top which is what I would expect. Is there a way that I can get it to render like the first example without manually specifying the z-inde开发者_StackOverflow社区x or using javascript?


I have needed to do something similar in the past. I solved it be floating all li's to the right and listing them in reverse order.

See this fiddle: http://jsfiddle.net/sl1dr/KfK9w/

0

精彩评论

暂无评论...
验证码 换一张
取 消