# \<img\> width and height attribute oddities

**URL:** <https://meta.discourse.org/t/img-width-and-height-attribute-oddities/26891>\
**Category:** Bug\
**Created:** [27 Marzo 2015, 11:26pm UTC](https://meta.discourse.org/t/img-width-and-height-attribute-oddities/26891 "2015-03-27T23:26:06Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![anon25879736](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@anon25879736](https://meta.discourse.org/u/anon25879736)\
**Post date:** [1 Aprile 2015, 3:06pm UTC](https://meta.discourse.org/t/img-width-and-height-attribute-oddities/26891/6 "2015-04-01T15:06:55Z")

</div>

> [@codinghorror](#):
>
> Arbitrary widths are not supported. The idea is that the image contains the correct width, either max thumbnail size, or the exact size if the image is smaller than the max thumbnail size.

It’s not really an arbitrary width though. It’s a quick way to scale the image. If only one dimension is provided, proper browser handling scales the image, as opposed to squishing/stretching the specified dimension.

To further elaborate on @RaceProUK’s issue, let’s take the same image and widths, but reverse the order that @RaceProUK used:

```plaintext
<img src="//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/3X/2/3/2302e458436b35f8493259805de0e2e91fd5038e.png" width="150">
<img src="//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/3X/2/3/2302e458436b35f8493259805de0e2e91fd5038e.png" width="100">
<img src="//cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/3X/2/3/2302e458436b35f8493259805de0e2e91fd5038e.png" width="50">

```

 ![](https://global.discourse-cdn.com/meta/original/3X/2/3/2302e458436b35f8493259805de0e2e91fd5038e.png)  
 ![](https://global.discourse-cdn.com/meta/original/3X/2/3/2302e458436b35f8493259805de0e2e91fd5038e.png)  
 ![](https://global.discourse-cdn.com/meta/original/3X/2/3/2302e458436b35f8493259805de0e2e91fd5038e.png)

Now, if that were really doing what you claimed, those should all be about 150px wide (actually 171px since that is the width of the source image), but they are all showing up as 50px wide. So you are claiming that “arbitrary widths” aren’t supported, when they are. It’s just the last width for a given image in a post is the only one used. Widths on all other instances of that image are overwritten.

---

_[View the full topic](https://meta.discourse.org/t/img-width-and-height-attribute-oddities/26891)._
