开发者

How do I select the last child of a div with only a certain name using only CSS?

开发者 https://www.devze.com 2022-12-23 11:42 出处:网络
I have been using the following CSS to apply an effect at the bottom of elements in a menu: .leftMenuProductWrapper div:last-child{margin-bottom:20px;}

I have been using the following CSS to apply an effect at the bottom of elements in a menu:

.leftMenuProductWrapper div:last-child{margin-bottom:20px;}

This works fine initially, however after adding more elements in the menu, I realized it was a problem. I really only want to select the last div with .leftMenuProductButton within .leftMenuProductWrapper

Anyw开发者_StackOverflow中文版ay to do this without using Jquery, just pure CSS?


Sounds like http://reference.sitepoint.com/css/pseudoclass-nthlastchild

Might want to check your browser compatibility though.

0

精彩评论

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

关注公众号