I
I
iNxiSt2018-02-15 13:21:46
css
iNxiSt, 2018-02-15 13:21:46

How to center an adaptive block?

Good day. What is the best way to center a block in the middle (vertically and horizontally) of any screen resolution, while maintaining the block's height/width proportions?
5a855f9905ae3724393830.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor Zhivagin, 2018-02-15
@Krasnodar_etc

Wrapper above the block:

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

A
Alexander Alekseev, 2018-02-15
@shure348

{
position: absolute;
margin: auto;
width: 90%;
height: 90%;
top: 0;
right: 0;
bottom: 0;
left: 0;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question