When you add an image in your tumblog one of the options to align it is “middle”. Those who know HTML will know that this align attribute has been depreciated, but the “middle” declaration is for centering vertically not horizontally. The user in question wanted just the images, not the text to be centered, and I wanted to try and achieve this without forcing them to edit classes or anything complicated. You might have thought that adding this to the CSS this would do the job:
p img {margin: 0 auto;}
but also no. Images are inline elements so they don’t understand the margin. However this will fix that:
p img {display:block;margin: 0 auto;}
Hope this helps someone!
2 responses to “Centering images in Tumblr”
It helped me! I’ve been trying to figure this out for hours.
Thanks v much.
LikeLike
Hi! I dont know where to place the code. Can you please help me? 😦
LikeLike