Given you want to center an element horizontally. Which one would you prefer?
.parent {
display: flex;
flex-direction: column;
align-items: center;
}
or
.parent {
display: flex;
justify-content: space-around;
}
Given you want to center an element horizontally. Which one would you prefer?
.parent {
display: flex;
flex-direction: column;
align-items: center;
}
or
.parent {
display: flex;
justify-content: space-around;
}
For further actions, you may consider blocking this person and/or reporting abuse
Ben Halpern -
Ben Halpern -
Viktoria Bors-Pajuste -
jeetvora331 -
Once suspended, niorad will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, niorad will be able to comment and publish posts again.
Once unpublished, all posts by niorad will become hidden and only accessible to themselves.
If niorad is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Antonio Radovcic.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag niorad:
Unflagging niorad will restore default visibility to their posts.
Top comments (5)
I didn’t know about the second one, but I definitely should try it.
Speaking of flexbox, I just found out today that you can use
place-items: center;
in place ofalign-items: center; justify-content: center;
.Cool! That's new to me. Doesn't seem to be widely supported yet, unfortunately.
I’ve always used the first option but only because I didn’t know the second was possible 😂
Gonna give that one a go when I get a chance!
Oh yes, the space-arounds are all very useful, especially for nav-bars. I think the first way is more readable since "center" is clearer than "space-around", but I'm writing the second one by default, since it's shorter and in my thinking, I try to solve for horizontal spacing first.
I've always used the second one. It never even crossed my mind to use flex-direction for that.
I'm always happy to learn a new way to solve a problem. Thanks for bringing this up!