css - 为每行对齐列表项中的内容

标签 css twitter-bootstrap

我正在努力实现以下目标:

1. max 2 cols, x rows
2. list item will wrap - if hide current item then next item will take its place
3. buttons must be aligned in both columns
4. there can be whitespace between the content and the button
5. no CSS3

目前一切看起来都很好,除了“BBBBBBBBBB”中的第二部分内容 - 链接:http://jsfiddle.net/jstime/t7319mpw/

图片帮助解释: enter image description here

最佳答案

Display:flex over used 可能有助于仅 css 测试:http://jsfiddle.net/t7319mpw/9/

#listofthings {
    background-color:gray;
    display:flex;
    flex-direction:row;
    flex-wrap:wrap;
}
#listofthings li {
    width: 300px;
   /* fall back for older browser */
   display:inline-block;vertical-align:top;/* middle or top or else */
   display:flex;
}

#listofthings li >div {
   display:flex;
    flex-direction:column;
    align-self:stretch;
}
div.text-center > div {
    flex:1
}

你的第一条评论似乎是一个很好的提示,可以通过 js 实现这一点

关于css - 为每行对齐列表项中的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25535127/

相关文章:

html - 强制导航栏元素保持在一行

html - 更改列表中元素符号的颜色?

css - 在 sencha touch 中为 Ext.list 设置不同的背景图片

html - Bootstrap Offcanvas - offcanvas css 类真的存在吗?

css - 在 bootstrap 中调整 Leaflet Map

css - 如何将 anchor 标记包裹在列表项周围? nedd 列表项元素符号

html - 如何对齐html中的两个文本区域

javascript - 为什么使用 Knockout js 时这个 twitter Bootstrap 模式不起作用?

javascript - 禁用 Bootstrap 字体

javascript - 为什么这个下拉菜单没有填充工作链接?