I want to center an element without writing any code for the parent.
I know
display:flex;
btw.
But it is for the parent not for the particular element.
THANKS
i suggest you look into https://www.w3schools.com/css/css_align.asp as this topic is not as simple as it may seem, but the short answer, which can work in majority of cases is set the element margin to auto
Thanks a lot. Okay .
you can use
justify-content : center;
Does it apply to the parent of to the element itself
But it didn’t work for me.
Didn’t work for me
justify-content can be applied to the child, when its parent have display: flex. Maybe if you give us a glimpse of your code with css for the parent and child, we can decide on whats the best solution for you
Oh! Okay!
Now I get it!
Thanks!
just set display:flex;
Thanks a lot, this is what I wanted, thanks
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.