Equal Height Borders For Bootstrap Columns

Category: CSS & CSS3 , Layout | July 30, 2018
Author: russmaxdesign
Views Total: 940
Official Page: Go to website
Last Update: July 30, 2018
License: MIT

Preview:

Equal Height Borders For Bootstrap Columns

Description:

A CSS extension for Bootstrap that adds equal height borders to Bootstrap columns.

Supports both Bootstrap 3 and Bootstrap 4 layout system.

How to use it:

Add the border class ‘col-border’ to Bootstrap columns as follows:

<div class="row row-relative">
  <div class="col-sm-4">
    <h2>Column 1</h2>
    <p>Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
  </div>
  <div class="col-sm-4 col-border">
    <div class="col-border-padding">
      <h2>Column 2</h2>
      <p>Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
    </div>
  </div>
  <div class="col-sm-4 col-border">
    <div class="col-border-padding">
      <h2>Column 3</h2>
      <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
    </div>
  </div>
</div>

The CSS to create equal height borders.

@media (min-width: 768px)
{
  .row-relative { position: relative; }

  .col-border 
  { 
    padding-left: 0; 
    position: static; 
  }
  
  .col-border-padding { padding-left: 15px; }

  .col-border:before 
  {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    border-left: 1px solid red;
  } 
}

Create the equal height borders using CSS transforms instead.

@media (min-width: 768px)
{
	.row-relative { position: relative; }

	.col-border 
	{ 
		position: static; 
	}
	
	.col-border:before 
	{
		content: "";
		position: absolute;
		top: 0;
		bottom: 0;
		border-left: 1px solid red;
		transform: translateX(-15px);
	}	
}

You Might Be Interested In:


Leave a Reply