W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2009

[whatwg] [HTML5] About the <pre> element

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 24 Nov 2009 23:27:20 -0600
Message-ID: <dd0fbad0911242127j750a873fhfd805c28f50ca79c@mail.gmail.com>
On Tue, Nov 24, 2009 at 11:07 PM, David Bruant
<bruant at enseirb-matmeca.fr> wrote:
> Writing the following is semantically sufficient and handles the
> presentation as expected :
> <code style="white-space:pre;">
> #include <stdlib.h>
> int main(){
> ? ?return EXIT_SUCCESS; // Because we always succeed !
> }
> </code>

This would break as soon as you met a client without CSS support, or
with insufficient CSS support.

> My proposition is to remove the <pre> element since it doesn't have
> another semantic than "present the information as I did (white spaces,
> line breaks)"

That's actually very valuable semantic information.  If whitespace is
important, then the information about it as such should be carried
with the document.  For an extreme example, consider a block of python
or haskell code - without the whitespace, it's simply a non-working

> For the ASCII art use case, what is said about "an alternative
> description" strongly reminds the alt attribute of the img element.
> Perhaps ASCII art should be done inside of an <img> element. The <img>
> element is probably the HTML element which has the closest semantic of
> the ASCII artist intention.

ASCII art is indeed semantically closest to <img> (it's just an image
done in a different medium), but there's no way to actually use <img>
as such.  <pre> is the second-closest thing if you're going to include
such a thing.

Received on Tuesday, 24 November 2009 21:27:20 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:19 UTC