[whatwg] Pre, code and semantics in HTML5: Wishful thinking?

Edward Z. Yang edwardzyang at thewritingpot.com
Sun Jun 22 14:36:53 PDT 2008

Hash: SHA1

Smylers wrote:
> Why would you need to -- surely you could just put the styling on the
> <code> instead (using pre + code to select only <code> elements inside
> <pre>-s)?

Lets say I want to place a background image of a computer behind spanses
of computer code, but a background image of a console for emulated
console data using samp and kbd.

With HTML 4, I would have done <pre class="code"> (or more likely, just
omitted it and assumed it was computer code by default unless otherwise)
and <pre class="console">.

With <pre><code>, you can't do that. <code> is an inline element, and
the background image doesn't get applied to it in any meaningful way.

I suppose one of the primary distinctions is that if you use
<pre><code>, it's usually because all of it's computer code.

- --
 Edward Z. Yang                        GnuPG: 0x869C48DA
 HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
 [[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the whatwg mailing list