简体   繁体   中英

Align text vertically with Bootstrap

Tried the solution here: vertical-align with Bootstrap 3 and here: vertical-align: middle with Bootstrap 2 didn't work.

This is the page: http://yonicks.com/falican/exemple.htm

Code:

<div class="container">
    <div class="row gray_back">
         <div class="col-md-6 content_area  vcenter ">

             <div class="col-md-2"></div>

             <div class="col-md-10 vcenter">
                 <h1 >text here need to be in the middle vertically</h1>
                 <h1 > also this</h1>
             </div>


             <div class="the_p_area">
                 <div class="col-md-2"> </div>

                  <div class="col-md-10">
                      also this also this also this also this also this also this also this also this

                  </div>

             </div>

         </div>


         <div class="col-md-6">
             <img src="img/fff.png" class="img-responsive" alt="Responsive image">
                        <br>
         </div>

    </div>

</div>

I'm using the latest version of Bootstrap.

How can I make the text align vertically?

you were close.

.row > .col-md-6 {
    display: table-cell;
    float: none;
    vertical-align: middle;
}

You Can use! line-height. The property vertical-align is very specific

for exapmple:

.yourclas{
 line-height: 2;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM