Is it possible to set a background in a bootstrap column that oversizes the div? [duplicate]

Updated 2018

Bootstrap 4, the concept is still the same: https://codeply.com/go/ffaQgse2SU

I have answered similar questions on this, but yours is a little different because the background-image. The best way I’ve found is using a CSS pseudo element becuase it adjusts along with right col-md-6 and therefore works responsively.

Bootstrap 3 Demo: http://codeply.com/go/rWOGi4LrU1

.right {
    z-index: 0;
    color: #fff;
}

.right:before {
    background-image:url(..);
    content: '';
    display: block;
    position: absolute;
    z-index: -1;
    width: 999em;
    /* allow for bootstrap column padding */
    top: -15px;
    left: -15px;
    bottom: -15px;
}

Demo

Also see:
Get Two Columns with different background colours that extend to screen edge

Leave a Comment