Inline Unordered List
#results {
font-family: arial, helvetica, sans-serif;
list-style-type:none;
}
#results li {display: inline;}
#results li a {
float:left;
}
I would like the results division to list multiple items per line, but it looks like I am getting only 1 item per line with this code开发者_JAVA百科.
You need to give the ul
margin: 0
and padding: 0
and the li
a width: 49%
for example (to leave some room for a margin-right
).
#results {
font-family: arial, helvetica, sans-serif;
list-style-type:none;
margin: 0;
padding: 0;
}
#results li {
display: block;
float:left;
width: 49%; /* Or whatever */
margin-right: 1%; /* Or whatever */
}
#results li a {
}
I will also add that I have another div within the results ul. It seems when I remove this inner division the results list horizontally.
<ul id="results">
<% for user in @users -%>
<li>
<div id="short_profile">
<.... ruby code ...>
</div>
</li>
<% end -%>
</ul>
精彩评论