Fixing image align issue in your WP theme

Posted on Sunday, 1 February 2015
How we make you an explainer video
Illustrating and coloring some more parts for an animation

Fixing image align issue in your WP theme

The current theme have had an issue with aligning images, they have appeared to the left when inserting them. The CSS is missing class for aligncenter.

This theme lacked the align functionality so center tag was used before. Center tags are deprecated, so you should avoid using them!

One fix to align an image is using text-align:center, which works:

farm-blog-post-image

That was done manually though, so not very good.

So we went ahead and added missing class for aligncenter at the bottom of our CSS:

.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}

Then, we inserted the image again, using the WP Text Editor:

aligncenter

Not working either in our theme.

So, after no luck with aligncenter, we spent some time on the Google and simply added this at the bottom of the themes style.css:

p.pic {
text-align: center;
margin: 0 auto;
}

Then when you insert an image using p class=”pic” then it works.

alt

We do need to manually add the p class=”pic” and /p but it’s pretty simple.

Now if anyone else had this problem with your WP theme, and like us are not very experienced in CSS, perhaps you will be helped by this post!

READY TO PARTNER? – CONTACT US FOR A FREE QUOTE!

Please fill out this quick animated video form and we’ll follow up.
Or call Anders Sundstedt: +44 (0) 7531 800 711.

First name*

Last name*

Your best contact number*

Your website

Your email*

How can we help? Details please!*

What's your budget?*

 By using this form you agree with the storage and handling of your data by this website. Privacy Policy. *

* Indicates Required


Back To Top

Anders is the Founder and Owner at Sundstedt Animation, where he creates handcrafted animated explainer videos, music videos and whiteboard videos. He lives in Glasgow, Scotland and enjoys film and photography. You can follow him on LinkedIn, Google+ and Twitter.

How we make you an explainer video
Illustrating and coloring some more parts for an animation
error: Alert: Content is protected !!