I think @Vucko has given the answer which points you to the correct direction but it's really not very dynamic. It's applicable only if you know the number of columns and the fixed number of rows. I would like to add this answer providing another workaround to solve your problem. I have to say that it's just a workaround, it does not use any kind of CSS selector because as I said, the solution given by Vucko seems to be the only most direct one.
The idea here is you can just add some pseudo-element to the ul
element, make it stick to the bottom and has the same background with the parent ul
so that it can hide the bottom lines. It's a pity that it also hides the vertical lines (the column-rule), if that does not really matter, I think you should choose this solution:
ul {
...
position:relative;
}
ul:after {
content:'';
width:100%;
height:34px;
position:absolute;
background-color:inherit;
bottom:0;
left:0;
}
Fiddle for 3 columns. You can change the number of columns without having to change any other.
NOTE: I'm pretty sure that there is no direct solution to your problem (which can select the last item in each column dynamically). Because all the items are laid out as columns but in fact they are just inline items contained by the parent ul
.
nth-child
nornth-last-child
could do the trick for what you're asking, and I doubt there's any other selectors which could allow for this. – Roland