I am trying to figure out the best way to create vertical multi-column lists in a grid framework like Bootstrap or Foundation. I already know how to do this in a couple of ways, but the way I want it I am not sure is possible to do with just CSS. I need the li tags to come directly after the ul tag without a col-*-* divs between.
To best describe what I want, I'll first show most people would roughly go about a 3 column list:
<ul class="row">
<li class="col-sm-4">A</li>
<li class="col-sm-4">B</li>
<li class="col-sm-4">C</li>
<li class="col-sm-4">D</li>
<li class="col-sm-4">E</li>
<li class="col-sm-4">F</li>
</ul>
The problem here is that the output will not be vertically read, and that is what I want. This would produce more of a horizontal list where the columns are not in the desired order like this:
A B C
D E F
Now here is my solution (not good enough):
<div class="row">
<div class="col-sm-12">
<div class="row">
<ul>
<div class="col-sm-4">
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
<li>F</li>
<li>G</li>
</div>
<div class="col-sm-4">
<li>H</li>
<li>I</li>
<li>J</li>
<li>K</li>
<li>L</li>
<li>M</li>
<li>N</li>
</div>
<div class="col-sm-4">
<li>O</li>
<li>P</li>
<li>Q</li>
<li>R</li>
<li>S</li>
<li>T</li>
<li>U</li>
</div>
</ul>
</div>
</div>
</div>
This way I get the desired order result of:
A H O
B I P
C J Q
D K R
E L S
F M T
G N U
But it's not good enough for me because the li tags do not immediately follow after the ul tag.
Is there any way I can accomplish this 3 column list without separating groups of li tags from one another?
Note: I'd also like to point out the benefit of doing it like example #1 which would give you automatic columns so that's great if you're working on an app or with PHP. I would hopefully like to keep that functionality if possible.
Thank you in advance to any assistance. This is tough to describe so please ask me a question to clarify if you don't understand. Thanks!
<li>tags to be children of the same<ul>, I would just have one<ul>percol-sm-4divulelements. However your method could still be a solution because what I really want to do is use the CSS selectorul > liand my example would not allow that because theli's are no longer direct children.