A
A
Andrey Kotosin2018-09-22 17:48:53
css
Andrey Kotosin, 2018-09-22 17:48:53

How to vertically align bootstrap 4 windows?

Hello. There was a task to make a block in the middle of the window, both vertically and horizontally. For the life of me, I can't figure out how to center relative to the window. Can someone tell me how to do this in bootstrap 4?
Now it’s like this:
5ba65624af1fe395580100.jpeg
But you need to do it like this:
5ba65632e9ad8564713813.jpeg
At the same time, you need to do something like that, regardless of the width and height of the browser window, the block always remains in the center (preferably when resizing that too)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
profesor08, 2018-09-22
@av_kotosin

And you are his flexes, flexes!

.block-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

jsfiddle.net/0vpb74c2/2 Bootstrap
even has classes for this: d-flex, align-items-center, justify-content-center, postscripts sm, md, lg, xl, too.

A
Alexey, 2018-09-22
@Softovick

Here it is described how to set the Vertical Align
position But this is most likely still needed so that the position always remains the same when changing the Position size

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question