How to apply vertical alignment for our float element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to apply vertical alignment for our float element?

I've trying to use vertical alignment for others and it works but doesn't with the float atributte https://code.sololearn.com/WafYXHW8dGLi/?ref=app

19th Aug 2021, 3:08 PM
Nur Anisa Hidayatul Masruroh
Nur Anisa Hidayatul Masruroh - avatar
3 Answers
+ 3
If u are new let me tell u theres a modern approach to center content using flex. Instead of: text-align: center; vertical-align:middle; display:table-cell; Use flex display: flex; justify-content: center; align-items: center; those float+clearing+ table cell were old hacks before flexbox and css grid. So dont take float to serious.
19th Aug 2021, 3:35 PM
Arturop
Arturop - avatar
+ 2
Nur Annisa Hidayatul Masruroh Change vertical-align:middle; to line-height: 75px;
19th Aug 2021, 4:28 PM
Calviղ
Calviղ - avatar
+ 1
Thank u so much 😁
19th Aug 2021, 3:46 PM
Nur Anisa Hidayatul Masruroh
Nur Anisa Hidayatul Masruroh - avatar