Why this p can't align vertical | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
18th Aug 2021, 3:07 AM
EsaKurniawan
6 Respostas
+ 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