O
O
onetwos2016-07-01 23:20:48
Bootstrap
onetwos, 2016-07-01 23:20:48

How to vertically center blocks in a row (or text in columns) in Bootstrap?

Found only this option:

<div class="container">
    <div class="row vertical-align"> <!-- 
                    ^--  Additional class -->
        <div class="col-xs-6"> ... </div>
        <div class="col-xs-6"> ... </div>
    </div>
</div>
.vertical-align {
    display: flex;
    align-items: center;
}

But this is how the grid turns from adaptive to rubber. Those. when you reduce the screen size, the blocks do not line up vertically, but simply scale.
Is there even a way to vertically center text in columns (or columns in a row) in Bootstrap? Well, as in the tables in general ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
onetwos, 2016-07-02
@onetwos

Thank you! Problem solved!

<div class="row">
  <div class="col-md-4 columns">1. Lorem ipsum dolor sit amet.<br>1. Lorem ipsum dolor sit amet.</div>
  <div class="col-md-4 columns">2. Lorem ipsum.</div>
  <div class="col-md-4 columns">3. Lorem.</div>
</div>

.columns{
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

S
Skrolea, 2016-07-01
@Skrolea

https://m.habrahabr.ru/company/netcracker/blog/277433/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question