RE: Error in validator

Interesting.  I wasn't aware that there were block elements that could
only contain inline elements.  I guess the only case that I can think of
where you would want a table element inside of a p element would be if
you actually had a table inside a paragraph and you didn't want your
paragraph to be split into two paragraphs, but rather to be one
paragraph split by the table.  Add CSS to the mix and it makes this
point more clear.  Suppose all of my paragraphs are setup to indent on
the first line (using CSS).  If that were the case, then doing this:
 
<p>Some text...</p>
<table>...</table>
<p>... some finishing text.</p>
 
would look much different than doing this:
 
<p>Some text...
<table>...</table>
... some finishing text.</p>
 
-Peter
 

-----Original Message-----
From: Thanasis Kinias [mailto:tkinias@asu.edu]
Sent: Tuesday, March 13, 2001 1:01 PM
To: Peter Foti (PeterF); 'www-validator@w3.org'
Subject: RE: Error in validator



Peter Foti wrote: 

> I am getting the error below in an XHTML strict document.  I don't 
> understand this because isn't the <p> element a block-level element? 

> Line 36, column 55: 
>      <p><table border="0" cellspacing="0" cellpadding="0"> 
                                                         ^ 
> Error: element "table" not allowed here; possible cause is an inline 
> element containing a block-level element 

<p> _is_ a block-level element, but not all block-level elements can
contain all other block-level elements. 

From the DTD < http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>: 

> <!ELEMENT p %Inline;> 
> <!ATTLIST p 
>   %attrs; 
>   > 

That means <p> can contain only inline elements; <table> is a
block-level element (like <p>). 

Why would you _want_ to put a <table> in a <p>? 

Thanasis Kinias 
Information Dissemination Team, Information Technology 
Arizona State University 
Tempe, Ariz., U.S.A. 

Qui nos rodunt confundantur 
et cum iustis non scribantur. 

Received on Tuesday, 13 March 2001 13:34:08 UTC