html - CSS last-child if more than 4 elements -
jsfiddle - i'm trying last element highlight if there more 4 containers within wrapper. possible using css instead of js
<div class="wrapper"> <div class="container">container #1</div> <div class="container">container #2</div> <div class="container">container #3</div> <div class="container">container #4</div> <div class="container">container #5</div> </div> .wrapper div:nth-child(n+4):last-child() { background-color: gold; }
yes. can achieve this. there small correction.
fiddle: http://jsfiddle.net/kiranvarthi/q5parpxy/4/
.wrapper div:nth-child(n+5):last-child { background-color: gold; }
Comments
Post a Comment