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

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

From: David Bruant <bruant@enseirb-matmeca.fr>
Date: Tue, 24 Nov 2009 21:07:50 -0800
Message-ID: <4B0CBBA6.6000203@enseirb-matmeca.fr>
Hi,

I recently learnt to use the white-space css rule
(http://www.w3.org/TR/CSS2/text.html#white-space-prop) and wondered if
the <pre> element was finally not just a presentational element since
its behavior can be emulated on other elements with a css rule.

On the CSS2 link I provide we can read this :
"The following example show what white space behavior is expected from
the PRE element [...]

pre        { white-space: pre }"
It gives me the impression that the pre element is a caricature of a
presentational element.

Thus, for the computer code use case described in the pre element
subsection, I don't see a reason to use a <pre> element.
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>

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

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.

Any opinion ?

David
Received on Tuesday, 24 November 2009 21:07:50 UTC

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