Inline element solution needed

Hi there, I have a problem centering an image and then I had been forced to use a display: block. Go here: See the button “Nuova discussione”? It is centered, but it is a block. I need it to be centered but not a block. I already tried margin-left: auto and margin-right: auto but for some reason it doesn’t work. How could I do in this case? Thank you a lot in advance for any reply.

1 Like

Have you tried display: inline-block;

Block elements are centered horizontally using margin:auto (assuming they have a width applied or are replaced elements with intrinsic width).

Inline elements or inline-block elements are centered by placing text-align:center on the parent block element


Thank you, this did the trick!


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.