id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 17044 div.wp-caption shortcode should have width of img, rather than add +10px mgk25 "In WordPress 3.1, file wp-includes/media.php function img_caption_shortcode() ends with the line return '
' [...] This line unfortunately hardwires into WordPress (apparently since version 2.6) a style-sheet issue, namely it makes the
that combines an image with its caption text 10 pixels wider that the image itself. Why, and why exactly 10px? This seems a bad idea for several reasons: - The addition of a caption needlessly changes horizontal spacing around a floating image by 10px, which looks awkward if a posting includes several left-floating images, some of which have captions and some of which do not (and therefore use no caption shortcode). Those images that have captions will have 10px additional space compared to those that do not, leading to an uneven appearance that can't be fixed neatly in theme CSS. - Any desired additional space could easily be offered in the theme CSS via a margin, and there is no need to hardwire this into the width, Such stylistic choices (such as 10px) should really be left to the theme CSS, rather than hardwired into WordPress. Proposed patch: Please replace in the above line the term (10 + (int) $width) with ((int) $width) in other words remove the hardwired additional width for the img+caption containing div. Users have complained about this issue many times in the support forum, and it clearly causes a lot of confusion and unexpected behaviour, but I haven't seen it yet filed as a bug: http://wordpress.org/support/topic/10px-added-to-width-in-image-captions http://wordpress.org/support/topic/attached-image-captions-adding-10px http://wordpress.org/support/topic/wp-caption-how-to-set-the-right-and-left-padding-for-captions http://wordpress.org/support/topic/control-of-image-caption-width http://wordpress.org/support/topic/should-i-edit-mediaphp A related complaint: http://core.trac.wordpress.org/ticket/9066 " defect (bug) closed normal Shortcodes 3.1 normal duplicate