[whatwg] [HTML5] A content in <img> elements for ASCII art

Markus Ernst derernst at gmx.ch
Wed Nov 25 00:52:25 PST 2009


David Bruant schrieb:
> Tab Atkins Jr. a écrit :
>> It's impossible at this point to make <img> elements take contents.
>> They're void elements in every single browser in existence.
>>   
> => I take this argument as a "pro" argument for two reasons :
> - <img> are void elements in every single browser, so, if this "status"
> changes in HTML5, they can all change the behavior of <img> element at
> the same time (which would be harder if some browser had already given a
> meaning to a <img> content)
> - web developers know that so far, <img> elements were void elements, so
> adding a content to <img> won't make the least retro-compatibility
> problem with what already exists.

I checked the following code in Firefox 3.5 and Internet Explorer 8:

<img style="white-space:pre; font-family:monospace">hello
preformatted
world</img>

Both browsers treat the text as following the img element, rather than 
being the contents of it. Neither applies the styling; IE additionnally 
displays a broken image placeholder before the text. This looks like a 
backwards compatibility problem to me.



More information about the whatwg mailing list