+ 1

I am confused in display:flex;

How does it work? It's so confusing!! https://sololearn.com/compiler-playground/WGjbxcC9Lgcx/?ref=app

5th Jun 2025, 8:29 AM
Manav Roy
Manav Roy - avatar
6 ответов
+ 3
display: flex is applied to the PARENT. You will need to use the other flexbox-attributes as well to understand what happens. See the link in the code example for an overview. https://sololearn.com/compiler-playground/WX9wE12KLHbx/?ref=app
5th Jun 2025, 9:04 AM
Lisa
Lisa - avatar
+ 5
Manav Roy flex is a lot more powerful than just centering text, it’s how you get the entire website to look the way you want. It isn’t something you will learn in a day so keep on learning about it and you will see what you can do with it.
5th Jun 2025, 12:18 PM
Zvi
Zvi - avatar
+ 4
You normally combine it with align-items: justify-content: https://sololearn.com/compiler-playground/Wz5QIwZwN9zF/?ref=app
5th Jun 2025, 8:51 AM
RuntimeTerror
RuntimeTerror - avatar
+ 3
Manav Roy I think my solution best answer your question but again, lady privilege wins Zvi exactly btw text-align is just for text, display attribute is for broad elements including containers
5th Jun 2025, 4:03 PM
RuntimeTerror
RuntimeTerror - avatar
+ 1
RuntimeTerror btw I havevn’t heard from you in a while! Welcome back😁
5th Jun 2025, 6:06 PM
Zvi
Zvi - avatar
0
RuntimeTerror Then why using flex at first place when we can just do text-align:center; ? p{ color: red; border:4px solid blue; position:relative; top:300px; font-style:italic; font-weight:bold; text-align:center; }
5th Jun 2025, 10:00 AM
Manav Roy
Manav Roy - avatar
OSZAR »