Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Via Bootstrap, how can I add a vertical divider in a well?

I'm using bootstrap to drawing a well. In this well, I create two span6 and would like to draw a vertical divider between these two column. How can I achieve my goal?

like image 528
waitingkuo Avatar asked Oct 08 '12 09:10

waitingkuo


2 Answers

Draw the left border on all, but first column:

.well [class^="span"] + [class^="span"] {
    margin-left: -1px; /* compensate border width */
    border-left: 1px solid #e3e3e3;
}

Alternatively, CSS columns can be used (prefixes required):

.well.col {
    columns: 2;
    column-gap: 20px;
    column-rule: 1px solid #e3e3e3;
}

If you have never use it before, you should check my tutorial on CSS columns.

like image 84
Pavlo Avatar answered Sep 30 '22 19:09

Pavlo


The selected answer breaks if your elements take up the entire width because the border adds 1px too many! To combat this you can adjust the margin to account for the border.

.line-right {
  margin-right: -1px;
  border-right: 1px solid black;
}

If you'd like a bigger border, just be sure to account for it in the margin!

like image 38
Tom Prats Avatar answered Sep 30 '22 18:09

Tom Prats