[wp-trac] [WordPress Trac] #50909: WordPress 5.5 update adds height and width attributes to images

WordPress Trac noreply at wordpress.org
Wed Aug 12 00:42:59 UTC 2020


#50909: WordPress 5.5 update adds height and width attributes to images
--------------------------+------------------------------
 Reporter:  jeslen        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by jeslen):

 Replying to [comment:10 pbgeneral]:
 > Replying to [comment:9 jeslen]:
 > > Replying to [comment:8 pbgeneral]:
 > > > I'm having precisely this issue. It has distorted the images on
 hundreds of my articles, so it's a pretty serious matter.
 > >
 > > Adding this CSS should resolve the issue.
 > > {{{
 > > img {
 > >   max-width: 100%;
 > >   height: auto;
 > > }
 > > }}}
 > >
 > > Although I'm not sure if this will prevent the height attribute from
 working in scenarios where that is preferred.
 >
 > Thanks. I'm not a tech person — what do you mean? Will there be
 unintended side effects from this?

 Certain attributes will override others. The image height attribute is
 overridden by the CSS style. So basically, if there was an image that was
 relying on the height attribute to set its height as something different
 than its actual size (e.g. the actual image file has a height of 100px,
 but the height attribute is 200px), then this CSS will override that.

 This is the reason why putting that CSS in will "fix" the image height
 attribute issue. It simply overrides the height attributes that have been
 applied with this update.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50909#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list