[wp-hackers] wp-hackers Digest, Vol 67, Issue 54

Ryan Hellyer ryan at pixopoint.com
Mon Aug 16 12:13:47 UTC 2010


> From: Otto <otto at ottodestruct.com>
>
> Well, my point is that if WP was doing the right thing here and using
> inline styles, then it wouldn't matter what the theme did. Inline
> styles always win.

Huh? WordPress does use inline styles. It adds them to the IMG tag as
it should do. The theme is over-riding that which it shouldn't be
doing.

> Stylesheets control the presentation, after all. In this
> case, the height and width of "auto" is merely expressing the default
> settings, and normally it'd be the correct way to do it.

No it isn't. The correct height and width is what is specified on the
IMG tags. The CSS is over-riding that and applying auto, which is the
width of the image itself.


> From: Rich Pedley <elfin at elfden.co.uk>
>
> But there is also a case for the width and height attributes on the
> img (isn't it still recommended?).

Yes, width and height attributes should always be applied to the IMG
tag. This is necessary so that the browser knows what dimensions to
give the image if the HTML is rendered before the images. This is a
particular problem with browsers which render the page before the CSS
or images have loaded (ie: Opera). If you don't specify them, things
can start flying around the page as the images are loaded which can be
quite disconcerting - and really annoying when it causes the page
content to move upwards as the page is loading (happens a lot on long
pages with lots of images scattered down the page).


More information about the wp-hackers mailing list