Borders between columns of Bootstrap Grid not working

南楼画角 提交于 2019-12-01 15:33:26

You need to use another block element (ie; DIV) inside the columns since Bootstrap 'col-*' uses padding to create the spacing or "gutter" between the grid columns.

 <div class="row text-center">
      <div class="col-md-3"> 
        <div class="cliente"> 
          ..
        </div>
      </div>
 </div>

Demo: http://www.bootply.com/71ZVOWCFWu

Carlos Macias

You can use outline property. NO cliente div is needed.

.row > div {
    margin-top:10px;
    padding: 20px;
    outline: 2px solid #ccc;
    outline-offset: -10px;
    -moz-outline-radius: 10px;
    -webkit-outline-radius: 10px;
 }
Ross Angus

I did a version which doesn't require extra elements, but might suffer from unequal heights:

How can I add a line between two columns using Twitter Bootstraps grid system

To expand on the outline solution, if you want a border that collapses to the same size if two adjacent columns both have borders, use box-shadow:

box-shadow: -.5px -.5px 0 .5px #ccc, inset -1px -1px 0 0 #ccc;

The downside to box-shadow versus outline is that box-shadow may be rendered by any browser at a subpixel position, whereas outlines and borders snap to the nearest pixel. If a box-shadow ends up on a subpixel position, it will appear soft or blurred. The only way to avoid this is to ensure you don't do things that will cause the column to be aligned on a subpixel position.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!