Reputation: 473
What's the best way to achieve something like this in a Ruby on Rails view with CSS:
This is what I have now:
List Item 1 - is not too long
List Item 2 - very,very long and I don't want the "column" to be this large; I want it to wrap
List Item 3 - hello
This is what I want:
The List Items come from a Solution class; the thumbs up/down are votes that come from a Solution_votes class.
Ideally, I would use a table with 3 columns, however, I am also using Axaj and JQuery to update and want to use an unordered list (to easily update using $('#items_list').prepend(new_item);).
Upvotes: 0
Views: 240
Reputation: 2315
HTML:
<ul class="entries">
<li>
<span class="title">List Item 1 - is not too long</span>
<a class="thumb down">0 Votes Down</a>
<a class="thumb up">0 Votes Up</a><!-- float:right will place this to the left -->
</li>
...
</ul>
CSS:
ul.entries { list-style: none; }
ul.entries li {
margin: 10px 0;
border: 2px solid black;
border-radius: 6px;
width: 600px;
}
ul.entries .title {
float: left;
width: 380px;
}
ul.entries .thumb {
float: right;
margin-left: 20px;
width: 90px;
/* todo: color, background + padding-left declarations for thumb icons */
}
Upvotes: 1