Help centering an element in a flex container

I have a flex container with flex-wrap: wrap. When it wraps the cta text breaks on another row, but when this happens I need it to be horizontally centered. I thought about creating a media query for when this happens and set justify-self: center to the element but that's a grid property. Any idea on how can I do that?
No description
5 Replies
MarkBoots
MarkBoots13mo ago
so there are multiple element inside your <a>? then probably justify-content: center; otherwise, share your code (the relevant part) in a codepen
! nier
! nierOP13mo ago
There are a text and an icon but that's not the point, what I need is this whole <a> to be centered not the elements inside
! nier
! nierOP13mo ago
Something like this
No description
MarkBoots
MarkBoots13mo ago
width: fit-content margin-inline: auto; and otherwise, make a codepen. way easier for us
! nier
! nierOP13mo ago
margin-inline: auto works just fine. Didn't know about this trick. Thank you!
Want results from more Discord servers?
Add your server