W3C home > Mailing lists > Public > www-html@w3.org > August 2002

Re: a new value for <title> and other meta tags

From: Chris Mannall <chris.mannall@hecubagames.com>
Date: Thu, 22 Aug 2002 10:17:46 +0100
Message-ID: <3D64AC3A.3020707@hecubagames.com>
To: www-html@w3.org

Lorenzo De Tomasi wrote:
 > My proposal is:
 >
 > If I write this code
 >
 > <html>
 >     <head>
 >     </head>
 >     <body>
 >         <title>Lorenzo De Tomasi</title>
 >     </body>
 > </html>
 >
 > every browser write "Lorenzo De Tomasi" as the title of the window 
and > as text in the body. The advantage is that I must write it only one
 > time.

This also has a number of disadvantages, however.

Firstly, as other people have mentioned, more often than not the title 
and the page heading will have different content, since the title must 
make sense out-of-context whereas the page heading is by definition 
always in the context of the page.

Secondly, it's fair to say that if you look at the web as a whole, the 
h1 element is far from always a direct child of the body element. For 
whatever reason, it's often a child of a div or (bleagh) table element. 
This causes problems in terms of validation; if you have to allow the 
potential use of the title element as a child of many different 
elements, there's no way to enforce that you can only have one title 
element in the document.

Next, there's the fact that the title element would have to be given a 
content model beyond plain text. I see a lot of pages with headings in a 
form like <h1><span>Important Word</span> minor word <span>Important 
Word</span></h1>, for reasons of styling... in order to allow this, the 
title element would have to be given a content model that allowed child 
elements.

Frankly, by this stage this is already beginning to sound pretty messy. 
The use cases are pretty narrow (since the majority of documents have 
differing titles and headings), and provide very few benefits (modern 
bandwidth makes saving twenty/thirty bytes pretty inconsequential, and 
keeping the title and heading in sync is hardly difficult).

For what it's worth, it would be fairly easy to achieve this with CSS if 
you could convince the CSS working group of its practical use. For 
example, CSS already defines the :before pseudo-element and the content 
property, which could potentially be used in this manner:

   <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <title id="documentTitle">the title of my document</title>
     <style type="text/css">/*<![CDATA[*/
        body:before { content:#documentTitle; }
     /*]]>*/</style>
   </head>
   <body>
     <p>My text</p>
   </body>
   </html>


This could cause the document title to be displayed in the page itself, 
before the content of the body element. Again, note that even in CSS3 
this is not defined as a possible use of the content property; it can 
take a number of value types, including strings and external URIs, but 
it does not at present allow fragment identifiers such as used in the 
above example.

See the CSS2 Generated Content section[1] for a full description of the 
:before pseudo-element and the content property. To my knowledge, there 
is currently not a CSS3 working draft covering this aspect of CSS.

Again, I still believe the use cases are very narrow.


- Chris Mannall


[1] http://www.w3.org/TR/CSS2/generate.html
Received on Thursday, 22 August 2002 05:30:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:52 GMT