This question has already been answered:
- How to center the text vertically? 2 answers
How to make alignment of several lines vertically (by block height) so that the lines are in the center and go in order. Is there any way?
This question has already been answered:
How to make alignment of several lines vertically (by block height) so that the lines are in the center and go in order. Is there any way?
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
div.container { display: flex; // новое свойство, подробнее по ссылке* flex-flow: column wrap; // каждый элемент внутри контейнера начинается с отдельной строки align-items: center; // вертикально по центру justify-content: center; // горизонтально по центру width: 500px; // эти 3 свойства - чтобы увидеть в действии, не обращайте внимание, они в данном примере роли не играют height: 600px; border: 1px solid #000; } <div class="container"> <p>Одна линия...</p> <p>2 линии...</p> <p>Да хоть 5 линий текста</p> </div> * link
By the way, it is possible to level not only at a strictly known height. Interest is also suitable. The only thing you probably shouldn’t forget is that in order for an element to be aligned vertically in the parent, the parent must be vertically more than the child element. But this, I think, is so understandable.
Source: https://ru.stackoverflow.com/questions/530507/
All Articles
Flex. - user207618displayproperty :) - user207618