Message from discussion
Transform a Span into a Div
Path: g2news2.google.com!postnews.google.com!73g2000cwn.googlegroups.com!not-for-mail
From: "Andy Dingley" <ding...@codesmiths.com>
Newsgroups: comp.infosystems.www.authoring.stylesheets
Subject: Re: Transform a Span into a Div
Date: 28 Dec 2006 06:31:58 -0800
Organization: http://groups.google.com
Lines: 56
Message-ID: <1167316318.080696.21930@73g2000cwn.googlegroups.com>
References: <1167270772.534976.260550@73g2000cwn.googlegroups.com>
<1167275037.400628.324380@a3g2000cwd.googlegroups.com>
<1167310625.001465.132720@79g2000cws.googlegroups.com>
NNTP-Posting-Host: 195.188.206.254
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1167316324 20206 127.0.0.1 (28 Dec 2006 14:32:04 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 28 Dec 2006 14:32:04 +0000 (UTC)
In-Reply-To: <1167310625.001465.132720@79g2000cws.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: 73g2000cwn.googlegroups.com; posting-host=195.188.206.254;
posting-account=FYMrigwAAACKaVo0YNlZI1en6kATkyzb
shapper wrote:
> Where can I find some information on nesting rules?
http://www.w3.org/TR/html4/sgml/dtd.html
Not the easiest thing to learn to read though! (search for "DTD
introduction" or something)
> Can I include a <div> inside a <span>?
No. Here's a small snippet of the DTD
<!--
HTML has two basic content models:
%inline; character level elements and text strings
%block; block-like elements e.g. paragraphs and lists
-->
Actually there's a third one too %flow;, which comprises both %inline;
and %block; elements
<!-- %inline; covers inline or "text-level" elements -->
<!ENTITY % special
"A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; |
%formctrl;">
So we see from this that <span> is one member of %inline; and also of
%flow; (see below)
<!ENTITY % block
"P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
<!ENTITY % flow "%block; | %inline;">
We see here that <div> is one member of %block; and thus of %flow; but
NOT %inline;
<!ELEMENT SPAN - - (%inline;)* >
<!ELEMENT DIV - - (%flow;)* >
<span> can contain anything from %inline;
<div> can contain anything from %block; or %inline;
So <div> can contain <span>, but <span> can't contain <div>
Now see if you can read the DTD yourself and see where <p> fits into
all this.