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

Thomas Broyer t.broyer at gmail.com
Wed Nov 25 08:12:46 PST 2009


On Wed, Nov 25, 2009 at 3:56 PM, Nikita Popov wrote:
> I think the idea of replacing the alt-attribute by the content of img is
> very good. An image used as an <img> needs to be content-related an
> therefore you often could place a descriptive text into it. This would lead
> us to img being only a normal HTML-element with normal content, but the
> ability of specifying an image by "src".
>
> On the problem of implementation:
> <img src="borken_url.jpg" style="white-space:pre;
> font-family:monospace"><span style="white-space:pre;
> font-family:monospace">Test
>  Hallo
>  World</span></img>
> If the browser knows the syntax, it'll render correct, if not it'll render
> correct only in case broken_url.jpg is really broken. Otherwise the text
> would be underneath it. So you would need to position the span over the img.
>
> I don't know whether it's worth the effort, but it would be a better syntax
> than alt, in my eyes.

There's already <object> for these cases where you want a "rich" fallback:
<object data="borken_url.jpg"><pre>
Test
 Hallo
 World
</pre></object>

-- 
Thomas Broyer
/tɔ.ma.bʁwa.je/



More information about the whatwg mailing list