Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Two column layout with a line in the middle.

[                      ] | [                      ] [                      ] | [                      ] [                      ] | [                      ] [     Left Column      ] | [    Right Column      ] [                      ] | [                      ] [                      ] | [                      ] [                      ] | [                      ] [                      ] | [                      ] 
like image 853
ehabd Avatar asked Aug 05 '12 08:08

ehabd


Video Answer


1 Answers

My solution uses the :before pseudo-element to put a positioned element between the columns. This doesn't require any more HTML elements and will just be applied to immediate child .col-* elements of the .border-between class. This should be applied to the same element as the .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; } 
like image 89
Ross Angus Avatar answered Oct 22 '22 04:10

Ross Angus