0

I have a bootstrap 3 based layout, with two columns, how can I make sure the text in the second aligns with the center (horizontal) of the page?

HTML:

<div class="row spaced">
    <div class="col-sm-2 text-center">
      <img src="Images/picture.png" alt="Image" height="100%" width="100%">
    </div>
    <div class="col-sm-10 text-center horizontal-center">
      <h1 class="text-box text-center horizontal-center">Are you interested?</h1>
      <button type="button" class="btn btn-primary btn-lg outline text-center">Find Out More</button>
    </div>
  </div>

CSS:

.horizontal-center {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    float: none;
}

JSFiddle

George Edwards
  • 8,979
  • 20
  • 78
  • 161

1 Answers1

0

You can pull the image left and take it out of the container, then make the div 12 so it will use the whole screen

<div class="col-sm-2 pull-left">
      <img src="Images/picture.png" alt="space taking image to push other columns off center" height="100%" width="100%">
 </div>
<div class="container">

  <div class="row spaced">

    <div class="col-sm-12 text-center horizontal-center">
      <h1 class="text-box text-center horizontal-center">Are you interested to find out more? Then click the button below.</h1>
      <button type="button" class="btn btn-primary btn-lg outline text-center">Find Out More</button>
    </div>
  </div>
</div>

https://jsfiddle.net/ygznu3gy/

Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156