"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
ἔρως
ἔρως6mo ago
the parent needs to be taking the entire width also, try display: inline-block
ShenZo
ShenZoOP6mo ago
unfortunately i tried both but didn't work :((
ἔρως
ἔρως6mo ago
then can you post a live example?
ShenZo
ShenZoOP6mo ago
it actually worked when i set text-aligned: center in the parent element
ἔρως
ἔρως6mo ago
that is another way, yes it all depends on the surrounding elements
ShenZo
ShenZoOP6mo ago
but there seems to be an overlapping issue now
ἔρως
ἔρως6mo ago
show a live example and explain the issue
ShenZo
ShenZoOP6mo ago
sorry my bad i have had commented out the
display:inline-block;
display:inline-block;
ἔρως
ἔρως6mo ago
and all issues are gone?
ShenZo
ShenZoOP6mo ago
yes! Thank you
No description
ἔρως
ἔρως6mo ago
you're welcome

Did you find this page helpful?