Odd behavior of width attribute for 'img' HTML tag


#1

I’m a bit confused by the odd behavior of the width attribute for an ‘img’ HTML tag. For example, I have the following three lines of code:

This seems odd but the width attribute… doesn’t seem to be working! For example, on this page, I have the following three lines:

<img src = "/_media/logos/pdf.png", width = "15", height = "200">

<img src = "/_media/logos/pdf.png", width = "200", height = "200">

<img src = "/_media/logos/pdf.png", height = "200">

All three render the same size (on this page here) (with a height of 200px, but what appears to be the maximum width). Here’s a screenshot of it:

Any idea what is going on here? Here is the source for the site.


#2

It seems like it must be due to a default theme setting.


#3

That theme appears to be fiddling with img tags using regex.


#4

Perhaps related to the regex issue, it looks like removing the comma, i.e. changing this from:

<img src = "/_media/logos/pdf.png", width = "15", height = "200">

to:

<img src = "/_media/logos/pdf.png", width = "15" height = "200">

fixed this issue!


#5

I have anyways never seen commas being used to separate HTML element attributes. You can see img tag examples here.