18th Aug 2021, 3:07 AM
EsaKurniawan
8 Réponses
+ 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; }
18th Aug 2021, 3:23 AM
Solo
Solo - avatar
+ 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%; }
19th Aug 2021, 1:40 AM
Calviղ
Calviղ - avatar
+ 1
I have already given you the answer.
18th Aug 2021, 3:51 AM
Solo
Solo - avatar
+ 1
19th Aug 2021, 11:16 AM
EsaKurniawan
+ 1
When u want to align a flexible content to the center vertically just make sure that it occupies the whole body..
19th Aug 2021, 2:41 PM
🔥 Fire Code 🔥
🔥 Fire Code 🔥 - avatar
0
Vasiliy how to do that
18th Aug 2021, 3:33 AM
EsaKurniawan