Opened 7 years ago
Closed 7 years ago
#43078 closed defect (bug) (duplicate)
Caption Max-width set incorrectly
Reported by: | jkorchok | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.9.1 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
After upgrading to 4.9.1, caption widths expressed in percentages are converted to max-width in pixels. A caption setting of width="100%" is converted to max-width="100px" in the page source. Below is the effect in both my custom theme and in the Twenty Fifteen theme.
Post text: [caption id="attachment_864" align="alignnone" width="100%"]
Page Source: <figure id="attachment_864" style="max-width: 100px" class="wp-caption alignnone">
Change History (6)
This ticket was mentioned in Slack in #core-media by desrosj. View the logs.
7 years ago
#3
@
7 years ago
I've been using width="100%" since 2013 and it worked as expected until upgrading to 4.9.1.
Are you familiar with the concept of Responsive web design? Here's an introduction: https://www.w3schools.com/css/css_rwd_intro.asp
Responsive design requires flexibility in object sizing and fixed pixel widths don't cut it. That's why I've been using percentage widths, and it's why someone needs to fix this.
When I look at the history of the
img_caption_shortcode
function, it has always used some form of(int) $width
for the sanitization of the width, so I don't see how a percentage would ever have worked.