Questions › How to center align two divs with different content?

I have two divs with the different content.i.e.

<div class="container-fluid" style="background-color:#2c5fd9;">
  <div class="row" style="padding:10px 0;">
    <div class="col-lg-1" style="display:table-cell;vertical-align:middle;border-right:1px solid #fff;">
      <div style="width:100%;color:#fff;">-</div>
    </div>

    <div class="col-lg-10" style="display:table-cell;vertical-align:middle;padding:0 10px;">
      <h1>The three big ideas we hope you take away</h1>
    </div>
  </div>
</div>

enter image description here

but I want it to display like the image above. How can I do that?

Comments :
divy3993 replied

Please post your relevant CSS code, along with sufficient HTML. Also are you using twitter-bootstrap?

Sohil Shah replied

yes, i am using twitter bootstrap. and all the css is given inline. no extra css is applied. i want the same effect as given in image


2 Answers :
Sebastian Brosch answered

This should be your solution:

HTML

<div class="container-fluid custom-box">
    <div class="row">
        <div class="col-lg-1 line">
            <div class="hr"></div>
        </div>
        <div class="col-lg-10 content">
            <h1>The three big ideas we hope you take away</h1>
        </div>
    </div>
</div>

CSS

.custom-box {
    background-color:#00577b;
    padding:30px 0;
    width:700px;
}
.custom-box .line {
    border-right:1px solid #fff;
    display:table-cell;
    padding:0;
    vertical-align:middle;
}
.custom-box .content {
    display:table-cell;
    padding:10px 40px;
    vertical-align:middle;
}
.custom-box .content h1 {
    color:#fff;
    padding:0;
    margin:0;
}
.hr {
    border-top:1px solid #fff;
    height:1px;
    width:75px;
}

Here is a fiddle to try: https://jsfiddle.net/sebastianbrosch/xat15tc1/1/

Sohil Shah replied
It works without using twitter bootstrap. but as soon as i place bootstrap.min.css it changes its layout;
Sohil Shah replied
Got it. there was a problem regarding float:left; applied to col-lg- class.;
CreativePS answered

Here is the updates code, it works well for me, hope it will resolve your issue.

<div class="container-fluid" style="background-color:#2c5fd9;">
        <div class="row" style="padding:10px 0; display:table; width:auto; margin:0px auto">
            <div class="col-lg-1" style="display:table-cell;vertical-align:middle;border-right:1px solid #fff;">
                <div style="width:100%;color:#fff;">-</div>
            </div>

            <div class="col-lg-10" style="display:table-cell;vertical-align:middle;padding:0 10px;">
                <h1 style="width:85%">The three big ideas we hope you take away</h1>
            </div>
        </div>
    </div>
Sohil Shah replied
no. it doesn't work.it's just same as before. adding style to row doesn't work at all;