I am looping through countries to get the list of the countries in alphabetical order. The desired form of display is as shown in the image below:

However I am currently getting it like this

I am using unordered list to achieve the desired result.
Here is the code :-
Code in the view :-
<% User.find(:all, :order => "name").group_by(&:initial).each do |initial, users| %>
<table>
<ul>
<li><%= content_tag(:h3, initial)%> </li>
</ul>
<% users.each do |user|%>
<ul>
<li> <%= link_to(user.name, user)%> </li>
</ul>
<% end %>
</table>
<% end %>
CSS:-
ul {
list-style: none;
}
Could anyone please guide me?
Thanks
Assuming that each letter + it's children is a li, and the ol is the surrounding tag, you could use something like:
ol {
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
Example: http://jsfiddle.net/rDQe5/1/
Mind you though that some browsers (esp. older IE versions) don't support this.
After you updated your question with code, some things:
div.ol), each letter is a li, and then for each country per letter another list (but this time unordered). I've updated my example to reflect that better.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With