A tip for vertical align: although transform/translate works, I would not recommend it for frequent centering as it forces the GPU to render your element. This is especially bad if you have many child elements.
A better way is to use display: flex with justify-content and align-items.
Beat me to the punch. 😊
To the OP, note that align-items is for vertical alignment while justify-content is for horizontal. This is assuming your flex-direction is "row".
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A tip for vertical align: although transform/translate works, I would not recommend it for frequent centering as it forces the GPU to render your element. This is especially bad if you have many child elements.
A better way is to use
display: flex
withjustify-content
andalign-items
.Beat me to the punch. 😊
To the OP, note that
align-items
is for vertical alignment whilejustify-content
is for horizontal. This is assuming yourflex-direction
is "row".