The way to use the CSS3 multi-column model is to create a new type of container between the content and the content called the column column .
Unfortunately, the current specification clearly indicates:
Cannot set properties / values โโin columns. For example, the background of a specific column cannot be set, and the column field has no concept of padding, margin, or border.
Therefore, at the moment there is no selector for column columns or elements inside, although on the same page there is a possibility that such a thing may be included in the future (why they did not think to include it in the present specification, outside of me).
Since you are claiming that you cannot edit the output on the server side, you need to use Javascript. I see that one solution already offers, although I do not agree with the approach to calculating the top position of li:first-child . Instead, I suggest the following:
var liNum = $('ul.columns li').length; // This computes the number of list items var colNum = 4; // This is the number of columns you want $('ul.columns li').each(function(i) { if ( i % Math.ceil(liNum/colNum) === 0 ) { $(this).addClass('top'); } });
Working demo
Of course, this is a little longer, but does not rely on the calculated top position (which is a visual property) or on li is :first-child . Instead, it relies on the number of items that are on the list, which in my opinion is an important number.
Of course, this assumes that you know how many columns you have (as you said, you do). If you want to not rely on this piece of information, you can simply calculate what CSS is instead:
var colNum = $('ul.columns').css('column-count')
Also, if you just want to add a border to the top and donโt want to style something, I would probably edit css directly through .css() instead of adding a class. If you need to customize the top element for more styles or other purposes (e.g. JS), I would add a class. But this is really a matter of preference.