"margin: 0 auto" won't center the <a> tag

Hi guys I have styled an anchor tag which looks like a button. I'm trying center it in the container but it won't happen. Does anyone know how to solve this ?
No description
No description
11 Replies
ἔρως
ἔρως5mo ago
the parent needs to be taking the entire width also, try display: inline-block
ShenZo
ShenZoOP5mo ago
unfortunately i tried both but didn't work :((
ἔρως
ἔρως5mo ago
then can you post a live example?
ShenZo
ShenZoOP5mo ago
it actually worked when i set text-aligned: center in the parent element
ἔρως
ἔρως5mo ago
that is another way, yes it all depends on the surrounding elements
ShenZo
ShenZoOP5mo ago
but there seems to be an overlapping issue now
ἔρως
ἔρως5mo ago
show a live example and explain the issue
ShenZo
ShenZoOP5mo ago
sorry my bad i have had commented out the
display:inline-block;
display:inline-block;
ἔρως
ἔρως5mo ago
and all issues are gone?
ShenZo
ShenZoOP5mo ago
yes! Thank you
No description
ἔρως
ἔρως5mo ago
you're welcome

Did you find this page helpful?