0
Why this p can't align vertical
6 Respuestas
+ 5
You have done the Alignment within a paragraph ☺️
If you want to set the paragraph itself to the center, then you need to write this in the body and set the height 100vh.
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
Also you can replace
align-items: center;
on
vertical-align: middle;
which will be more informative for your case. ☺️
body {
display: flex;
flex-direction: column;
vertical-align: middle;
justify-content: center;
height:100vh;
}
+ 3
Set body to full height is not enough to make this p to align vertically center.
You have to set html, body and p to full height.
html,
body,
p {
height: 100%;
}
+ 1
I have already given you the answer.
+ 1
Kode Krasher thanks
+ 1
When u want to align a flexible content to the center vertically just make sure that it occupies the whole body..
0
Vasiliy how to do that