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

Did you find this page helpful?