How can i align some block that floated? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

How can i align some block that floated?

I want align some tags that floated to right , align them in center of content, how can i do it?

13th Apr 2019, 9:30 PM
A B O O Z A R - E S M A I L I
A B O O Z A R - E S M A I L I - avatar
4 Answers
+ 2
You can not center floating elements. Floating elements can can only go right or left if you want to center elements then make sure their not floated.
14th Apr 2019, 12:10 AM
Ryan
Ryan - avatar
+ 5
you cant. They can just be float:right; or float:left; The only thing u could do is to align it inside a div :)
15th Apr 2019, 4:22 PM
I‘m Sarah🌹
I‘m Sarah🌹 - avatar
+ 4
A B O O Z A R - E S M A I L I Try this: <p align="center"> This text is aligned to center </p>
13th Apr 2019, 9:36 PM
Jella
Jella - avatar
+ 2
learn flexbox, floating isnt the best solution .parent{ display:flex; justify-content:center; align-items:center; }
15th Apr 2019, 9:52 AM
Logomonic Learning
Logomonic Learning - avatar