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

Smylers Smylers at stripey.com
Sun Jun 22 14:32:12 PDT 2008


Edward Z. Yang writes:

> ... authors are recommended to use <pre><code> to wrap all of their
> programming code instead of a lone <pre>, if they wish to be fully
> semantic. This ... makes it extremely difficult to style pre as a
> block for code, as the only semantic indication that the contents of
> the pre block are computer code is its child. You'd end up having to
> say <pre class="code"><code> if you wanted to style pre as well.

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)?

Smylers



More information about the whatwg mailing list