I have an image placed in a widget on my WordPress blog. I want the image to be centered since it's smaller than the sidebar it is placed in.
I currently use the following code:
<img style="display: block; margin-left: auto; margin-right: auto; padding-bottom: 10px; width: 150px; height: 155px;" src="path">
But the image aligns left.
What am I doing wrong?
Many thanks!
Try margin: 0 auto
instead of declaring them separately. Also you can try adding text-align: center
to to it's container or parent div
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With