HTML validation issue

  • seularts
  • Graduate
  • Graduate
  • User avatar
  • Posts: 153
  • Loc: Romania

Post 3+ Months Ago

I can't valiate this piece of code here:

<h5 id="copy">
<p class="copybox1">
Partners &amp; Ads:<br /><br />
<?php
$random=array
(
'<a href="http://www.tzr.ro/contact4.php" id="copylink2">Vrei mai mult?</a> <a href="http://www.tzr.ro/contact4.php">Coding CSS</a> <a href="http://www.tzr.ro/contact4.php">Tips &amp;&amp; Tricks pentru Design!</a>',
'<a href="http://www.tzr.ro/contact4.php" id="copylink2">Mai multe template-uri!</a>',
'<a href="http://www.tzr.ro/contact4.php" id="copylink2">Mai multe carti de vizita!</a>',
'<a href="http://www.tzr.ro/contact4.php" id="copylink2">Coding CSS</a>',
'<a href="http://www.tzr.ro/contact4.php" id="copylink2">Tips &amp;&amp; Tricks pentru Design!</a>',
);
$array_random = $random[rand(0, count($random) - 1)];
$array_random = trim($array_random);
print $array_random;
?>
| <a href="partners.php">more..</a>
</p>
<p class="copybox2">
<a href="http://www.tzr.ro/copy.php">&copy;2008 TZR.ro</a>
|
<a href="http://www.tzr.ro/contact4.php" class="copylink">&divide; About us</a>
<a href="http://www.tzr.ro/contact4.php" class="copylink_r">&divide; FAQ</a>
<a href="http://www.tzr.ro/contact4.php" class="copylink_r">&divide; Site Map</a>
<a href="http://mail.google.com/a/tzr.ro" class="copylink_r" target="_blank">&divide; E-Address</a>
<a href="http://www.tzr.ro/contact4.php" class="copylink_r">&divide; Help!</a>
<a href="http://www.tzr.ro/contact4.php" class="copylink_r">&divide; Ads</a>
<a href="http://www.tzr.ro/contact4.php" class="copylink_r">&divide; Link to us</a>

</p>
</h5>


i get this output from the html validator:

# Error Line 83, Column 19: document type does not allow element "p" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.

<p class="copybox1">



The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
# Error Line 87, Column 19: document type does not allow element "p" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.

<p class="copybox2">



The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

were could i be going wrong!?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

the <p> tag is not allowed to be inside the <h5> tag ... seems that that is all ...
  • seularts
  • Graduate
  • Graduate
  • User avatar
  • Posts: 153
  • Loc: Romania

Post 3+ Months Ago

yep.. fixed that now.. stupid tags .. why can't they just bond togheter!?
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

because they <h5> and the <p> are both inline elements ... and something inline doesn't go into something inline ...
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

righteous_trespasser wrote:
because they <h5> and the <p> are both inline elements ... and something inline doesn't go into something inline ...


Actually, that's not quite right.

Both <H*> and <P> elements are considered block-level elements, they're actually the first two defined in the %block; definition in the HTML4.01-loose DTD. %heading; being shorthand for h1-h6.
Code: [ Select ]
<!ENTITY % block
     "P | %heading; | %list; | %preformatted; | DL | DIV | CENTER |
      NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR |
      TABLE | FIELDSET | ADDRESS">
  1. <!ENTITY % block
  2.      "P | %heading; | %list; | %preformatted; | DL | DIV | CENTER |
  3.       NOSCRIPT | NOFRAMES | BLOCKQUOTE | FORM | ISINDEX | HR |
  4.       TABLE | FIELDSET | ADDRESS">


The h1-h6 elements, in an HTML4.01-loose DTD will accept %inline; child elements, which <p> is not.
Code: [ Select ]
<!ELEMENT (%heading;)  - - (%inline;)* -- heading -->
<!ATTLIST (%heading;)
  %attrs;                              -- %coreattrs, %i18n, %events --
  %align;                              -- align, text alignment --
  >
  1. <!ELEMENT (%heading;)  - - (%inline;)* -- heading -->
  2. <!ATTLIST (%heading;)
  3.   %attrs;                              -- %coreattrs, %i18n, %events --
  4.   %align;                              -- align, text alignment --
  5.   >


If either of these code blocks looks strange to you, check out my DTD tutorial here at Ozzu. :D
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

Thanks joebert ...

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 50 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.