Re: Don't deprecate tt

On Tue, 18 Dec 2007, Matthew Szudzik wrote:
> 
> In the current (12 December 2007) draft of the HTML 5 specification, the 
> <tt> tag is absent.  I personally use the <tt> tag in my work, and I 
> would like to persuade individuals to re-introduce <tt> back into the 
> specification.
> 
> In documents that describe computer languages, it is important to 
> discuss the typographic conventions used to describe those languages. 
> For example, here is one such discussion of typographic conventions
> 
>  http://rand-mh.sourceforge.net/book/overall/thefor.html
> 
> which contains the following HTML code snippet
> 
>  <dt><tt>Teletype</tt>
>  <dd>(constant width) is used for sample code fragments and examples.
>
> Note that the content of the document makes explicit reference to a 
> style of presentation.  It is not possible to separate presentation from 
> content.  If the <tt> tag were replaced with a <code> tag, and if a 
> style sheet were to render the content of <code> tags in Helvetica, for 
> example, then the meaning of this content would be lost.  So, <tt> is 
> the proper semantic tag in this context, because the author is 
> discussing teletype text.

The right thing to do is to use the same semantic in the part describing 
the conventions as is used in the rest of the book. For example:

   <dt><code>Code</code>
   <dd>Used for sample code fragments and examples.
   <dt><var>variable</var>
   <dd>Used for variables.

Otherwise, the rendering of the conventions section could differ from the 
actual styles used in the rest of the book, e.g. if the user has a 
stylesheet the author wasn't expecting.


> The <tt> tag is also of practical use in documents that describe 
> computer interfaces.  For example, consider the following computer 
> operating system installation instructions
> 
>  http://openbsd.org/faq/faq4.html
> 
> which contain the following HTML code snippet
> 
>  <li>Erase the character you typed to stop the boot, type<br>
>  <tt><b>boot /4.2/i386/bsd.rd</b></tt><br>
>  then press <i>Enter</i>.

This should be written:

   <li>
    <p>Erase the character you types to stop the boot, type:</p>
    <pre><kbd>boot /4.2/i386/bsd.rd</kbd></pre>
    <p>then press <kbd><kbd>Enter</kbd></kbd>.</p>

...or some such. (The <br>, <tt>, <b>, and <i> tags are _all_ misused in 
the above snippet, per HTML5!)


> The important point is that these instructions should simultaneously be 
> readable from a full-featured, graphic web browser such as Firefox, and 
> from a legacy, text-only web browser such as Lynx, because an individual 
> may need to refer to the instructions using a terminal interface, before 
> the graphic user interface has been fully installed on a machine.

The above examples work in all those browsers.


> Now, text-only browsers like Lynx ignore style sheets, so the document 
> must be marked-up with presentational elements such as <b> (which, for 
> example, renders in blue using Lynx on my machine's terminal interface), 
> instead of semantic elements like <kbd>, which are ignored.  I note that 
> presentational elements such as <b> and <i> are included in the HTML 5 
> specification, and facilitate the use of HTML in this practical 
> circumstance.

<b> and <i> aren't presentational as defined in HTML5, and legacy 
text-only UAs have long supported the non-presentational elements even 
without style sheets.


> Even though the <tt> tag is ignored by the text-only browser, the same 
> document must be readable from a graphic web browser.  If <code> were to 
> be used instead of <tt> in the snippet above, then the HTML becomes a 
> seemingly inconsistent mix of presentational and semantic markup.  For 
> the sake of consistency, the <tt> tag is preferred.

For the sake of consistency, non-presentational markup is preferred 
througout.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 7 May 2008 01:23:54 UTC