[wp-hackers] WP-Caption/Image use inline styles

Moya, Eddie emoya at tribune.com
Tue Feb 16 22:39:27 UTC 2010

I have run into a tough problem on (ugh) ie6, however this issue has been
exacerbated by the way WordPress styles these two particular elements.

To keep this short, the ultimate road block was that the editor tools for
embedding images and for wp-caption stick a combination inline css and html
attributes into the post for image sizing. In this particular instance, it
became difficult to override the inline styles in ie6 for reasons I wont go
into here. However I will talk a little bit about the solution.

This is a problem that presents itself in both images (which are posted as
html in the editor), and in wp-caption (which is set up through a
shortcode). Solutions to this include adding filters to the_content (but
that is kind of dirty, since we only really want to target images and
wp-caption. The solution we have now implemented rewrites the shortcode for
wp-caption to remove the inline styling. However we are still left with the
html attributes assigned to the images. Removing it from captions has solved
problems experienced in this instance ­ perhaps there are better solutions
out there for this but that not the point of this email.

The point of this email, is to get an understanding about why there are
inline styles at all. It seems to go against the general philosophy of
leaving styling to the theme developers. Although the aforementioned
solution sufficed to solve this instance of the problem, it was quite a lot
of work for something that really shouldn¹t be that difficult and wouldn¹t
have been so difficult if there simply were no inline styling involved.

So is there some rationale behind the inline styling that I am not aware of?

Eddie Moya
Applications Developer
Tribune Technology
emoya at tribune.com

More information about the wp-hackers mailing list