CSS/Ruby on Rails - 将列表分成三个独立的等宽列

标签 css html-lists

在 Ruby on Rails View 中使用 CSS 实现类似效果的最佳方法是什么:

这是我现在拥有的:

列表元素 1 - 不太长 enter image description here enter image description here
列表元素 2 - 非常非常长,我不希望“列”这么大;我想让它包装 enter image description here enter image description here
list 元素 3 - 你好 enter image description here enter image description here

这就是我想要的:
enter image description here

列表项来自解决方案类;赞成/反对是来自 Solution_votes 类的投票。

理想情况下,我会使用一个包含 3 列的表,但是,我还使用 Axaj 和 JQuery 来更新并希望使用无序列表(以便使用 $('#items_list').prepend(new_item); 轻松更新) ).

最佳答案

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 */
}

关于CSS/Ruby on Rails - 将列表分成三个独立的等宽列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11543015/

相关文章:

html - 垂直居中多行 flex 元素

html - 使列表项样式彼此独立

css - 带有嵌套 `overflow-x: hidden` 的列表隐藏了列表计数器/点 - 为什么/这是一个错误?

html - css 列表样式中的 upper-alpha 和 upper-latin 有什么区别?

css - 如何使用 fontawesome 图标作为无序列表的默认元素符号?

javascript - 这段代码有什么问题,尝试点击菜单吗?

iphone - 切换器中的 iOS Web 应用程序

CSS 颜色 anchor ,但不是 A :hover

javascript - 设置附加列表项的限制

html - 制作导航栏的元素html