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

Otto otto at ottodestruct.com
Thu Feb 18 14:37:30 UTC 2010


On Tue, Feb 16, 2010 at 4:39 PM, Moya, Eddie <emoya at tribune.com> wrote:
> 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?

To which inline styling are you referring?

The only styling I'm aware that the image captioning system uses is
width and height, and those belong inline because they will be
different for each image, due to image sizes being different.

You can't generically style image sizes, and not specifying them is
bad form as it causes page rendering slowdowns (image spaces can be
rendered before the image loads if the width/height is given).

-Otto
Sent from Memphis, TN, United States


More information about the wp-hackers mailing list