grid - 如何使用 Twitter Bootstraps 网格系统在两列之间添加一条线

标签 grid twitter-bootstrap

两列布局,中间有一条线。

[                      ] | [                      ]
[                      ] | [                      ]
[                      ] | [                      ]
[     Left Column      ] | [    Right Column      ]
[                      ] | [                      ]
[                      ] | [                      ]
[                      ] | [                      ]
[                      ] | [                      ]

最佳答案

我的解决方案使用 :before 伪元素在列之间放置定位元素。这不需要更多的 HTML 元素,并且仅应用于 .border- Between 类的直接子 .col-* 元素。这应该应用于与 .row 相同的元素。

HTML

<div class="row border-between">
  <p class="col-sm-6">This column does not have a border, because it's a first child.</p>
  <p class="col-sm-6">This column has a border to the left</p>
</div>

CSS

.border-between > [class*='col-']:before {
   background: #e3e3e3;
   bottom: 0;
   content: " ";
   left: 0;
   position: absolute;
   width: 1px;
   top: 0;
}

.border-between > [class*='col-']:first-child:before {
   display: none;
}

关于grid - 如何使用 Twitter Bootstraps 网格系统在两列之间添加一条线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11815081/

相关文章:

grid - amchart 在网格之间添加标签

python - 将文件中的行追加到列表中

html - 图片不适合背景图片

html - 如何修复 : even list elements not working

HTML - 重新排序 Bootstrap 列

vue.js - vue js 的响应式图像网格库

html - 在这种情况下使用整数作为类名是否可以接受/正确

javascript - 如何过滤 EXTJS 网格列表过滤器?

javascript - 单击添加/删除隐藏的溢出

asp.net-mvc-4 - Nuget 外部包不能依赖于目标项目的包