PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.info.authoring.html > question about the BODY tag in the HTML DTD
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
question about the BODY tag in the HTML DTD

Réponse
 
LinkBack Outils de la discussion
Vieux 08/04/2008, 20h36   #1 (permalink)
Bart Lateur
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut question about the BODY tag in the HTML DTD

In the DTD of HTML 4.01, <http://www.w3.org/TR/html401/sgml/dtd.html>,
it states that the only legal elements in the BODY element are block
tags (and a few more: SCRIPT, INS and DEL):

<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->

These block elements are the following:

<!ENTITY % block
"P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">

Where %heading; is the tags H1 to H6, %list; is UL and OL, and
%preformatted; is PRE.

That is all.

So, if I get this correctly, it is not legal to put text, or inline
elements (text formatting, SPAN) directly into a BODY tag. None of these
tags are implied. Yet, people do it all the time.

What gives? Am I misunderstanding the spec, or a people doing it wrong?

--
Bart.
  Réponse avec citation
Vieux 08/04/2008, 21h08   #2 (permalink)
Joost Diepenmaat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: question about the BODY tag in the HTML DTD

Bart Lateur <bart.lateur@pandora.be> writes:

> So, if I get this correctly, it is not legal to put text, or inline
> elements (text formatting, SPAN) directly into a BODY tag.


I'm too lazy to check, but that's my recollection too. Also, IIRC the
w3c HTML validator will warn on these cases.

> None of these tags are implied. Yet, people do it all the time.
>
> What gives? Am I misunderstanding the spec, or a people doing it wrong?


People are doing it wrong. But since it mostly works, they'll keep on
doing it. This also goes for all the other places where non-blocks
aren't allowed.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
  Réponse avec citation
Vieux 08/04/2008, 21h15   #3 (permalink)
Harlan Messinger
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: question about the BODY tag in the HTML DTD

Bart Lateur wrote:
> In the DTD of HTML 4.01, <http://www.w3.org/TR/html401/sgml/dtd.html>,
> it states that the only legal elements in the BODY element are block
> tags (and a few more: SCRIPT, INS and DEL):
>
> <!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
>
> These block elements are the following:
>
> <!ENTITY % block
> "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
> BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
>
> Where %heading; is the tags H1 to H6, %list; is UL and OL, and
> %preformatted; is PRE.
>
> That is all.
>
> So, if I get this correctly, it is not legal to put text, or inline
> elements (text formatting, SPAN) directly into a BODY tag. None of these
> tags are implied. Yet, people do it all the time.


People also exceed the speed limit and fail to declare gambling winnings
to the tax authorities.

> What gives? Am I misunderstanding the spec, or a people doing it wrong?


In earlier HTML it was OK, and it's still OK in HTML 4.01 Transitional,
but not in Strict.
  Réponse avec citation
Vieux 08/04/2008, 21h21   #4 (permalink)
Nick Theodorakis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: question about the BODY tag in the HTML DTD

Bart Lateur wrote:
> In the DTD of HTML 4.01, <http://www.w3.org/TR/html401/sgml/dtd.html>,
> it states that the only legal elements in the BODY element are block
> tags (and a few more: SCRIPT, INS and DEL):


[...]

>
> So, if I get this correctly, it is not legal to put text, or inline
> elements (text formatting, SPAN) directly into a BODY tag. None of these
> tags are implied. Yet, people do it all the time.
>
> What gives? Am I misunderstanding the spec, or a people doing it wrong?
>


People are either doing it wrong, or else using a transitional doctype
where it is allowed.

Nick


--
Nick Theodorakis
nick_theodorakis@hotmail.com
contact form:
http://theodorakis.net/contact.html
  Réponse avec citation
Vieux 09/04/2008, 11h34   #5 (permalink)
Andy Dingley
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: question about the BODY tag in the HTML DTD

On 8 Apr, 20:36, Bart Lateur <bart.lat...@pandora.be> wrote:

> What gives? Am I misunderstanding the spec, or a people doing it wrong?


This is correct (but just for 4 Strict, not 3.2 or Transitional) and
most coders do indeed use it wrongly.

The intention is a clear and simple one, if only you're aware of it.
%inline; elements are considered to be "bare" and without well-managed
container boxes, so shouldn't be placed naked onto a page.

You can even extend this attitude so that %inline; content shouldn't
be used in a %block; context in general. This isn't expressed in the
DTD, because most contexts accept %flow; rather than %block; alone.
However mixing inline and block elements as siblings is not a
recommended practice, certainly not at the higher scale of the DOM.

As a specific example, I often float <div> around on a page (image/
caption containers) to avoid the rigid grid look of simple CSS
layouts. It's also necessary to place a HTML element after these with
clear used to tidy up after the floating. I used to use a <br> for
this. That worked fine, and because they were all contained in overall
<div> anyway, it was even valid. However I now regard it as
inappropriate, so I use <hr> instead (with some CSS to make the usual
horizontal rule disappear).
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h39.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12046 seconds with 13 queries