Media: Use max-width for default captions.

This alters the HTML output of the image caption shortcode to use
`max-width` instead of `width` to improve compatibility with
flexible layouts.

Props aaronrutley, desrosj.
Fixes #33981.


git-svn-id: https://develop.svn.wordpress.org/trunk@41724 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe McGill
2017-10-04 02:49:19 +00:00
parent 156c8ec5c6
commit fa43ebdefd
3 changed files with 78 additions and 7 deletions

View File

@@ -1578,7 +1578,7 @@ function img_caption_shortcode( $attr, $content = null ) {
$style = '';
if ( $caption_width ) {
$style = 'style="width: ' . (int) $caption_width . 'px" ';
$style = 'style="max-width: ' . (int) $caption_width . 'px" ';
}
if ( $html5 ) {