Fredrik Medin wrote:
> You get an error when you do it like this:
> <pre><img src="test.gif" alt="test" /></pre>
> And still it shows perfectly in both IE and FF.
Yeah, that is just as it is, the syntax does not
allow images within <pre>. Even where that could
work, depending on the browser and the image.
Things you can do:
(1) Ignore the error if you are sure that you are
not interested to find another solution.
(2) Cheat, put the image into a <span> within the
<pre>. That's actually a variant of (1), and
it only works because *this* validator at the
moment isn't smart enough to detect that trick.
(3) Roll your own syntax allowing what you want.
That's utter dubious, because you likely don't
know all reasons why it's not permitted in the
official specification.
(4) Use image within <tt> instead of <pre> if all
you want is mono-spaced. Don't try that in
HTML5-asinine, where they intend to kill <tt>.
(5) Use image within <span> instead of <pre> with
span-styles doing what you want for browsers
supporting CSS.
(6) Use image within <div> instead of <pre> with
span-styles doing what you want for browsers
supporting CSS. (4) or (5) vs. (6) are very
similar, and it depends on the context what's
allowed and/or better.
Lots of options,
Frank
--
<http://omniplex.blogspot.com/2008/07/html5-asinine-selfish.html>