kaitco
12-11-2006, 09:31 PM
When I attempt to validate my code with XHTML strict, I receive errors on line breaks and I am not sure why. I have been using <br /> with XHTML transitional for the longest time with no problems and I am certain that I have used it in the past with a strict doctype.
This is the error I am receiving:
Error Line 77 column 5: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<br />
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>").
I think that there must be something else wrong with my code, but I cannot find it. Can anyone tell me why I am getting this error with <br />?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<!-- all html written by Dorienne Smith -->
<head>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="home.css" type="text/css" />
<meta name="keywords" content="dorienne smith, calvin and hobbes, calvin, hobbes, bill watterson, comics, downloads, pictures, images, gifs, books, facts, poetry" />
<meta name="description" content="Midnight Calvin - For those whose midnight pastime is re-discovering the beloved comic Calvin and Hobbes" />
<meta name="owner" content="kaitco@doriennesmith.com" />
<meta name="author" content="Dorienne Smith" />
<meta http-equiv="content-language" content="English" />
<meta name="rating" content="General" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Poetry - Midnight Calvin -- Dorienne Smith.com</title>
<style type="text/css">
html, body {
color: #fff;
background: #000;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
}
a {
color: #fff;
}
a img {
border-style: none;
}
ul {
list-style: none;
font-size: 12px;
text-align: center;
}
li {
display: inline;
}
h1 {
text-align: center;
}
dl {
padding: 1em 0;
}
dt {
font: normal large Verdana, Arial, Helvetica, sans-serif;
}
dd {
font: normal small Tahoma, Arial, Helvetica, sans-serif;
}
p {
font: medium, Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
}
#footer {
text-align: center;
}
</style>
</head>
<body>
<?php include ("nav.php"); ?>
<h1><a id="top"><img src="images/players/newpoetry.gif" alt="Poetry" /></a></h1>
<br />
<ul>
<li><a href="#alien">Alien Brain Drain</a></li>
<li><a href="#mind">Exploring Mind</a></li>
<li><a href="#mum">My Mom and Dad</a></li>
<li><a href="#night">Nauseous Nocturne</a></li>
<li><a href="#sixmas">Six Days 'Til Christmas</a></li>
<li><a href="#trex">The Tyrannosaur</a></li>
<li><a href="#water">Water-Stealing Blue Collar Work</a></li>
<li><a href="#eve">Christmas Eve</a></li>
</ul>
<dl>
<dt><a id="alien">Alien</a> Brain Drain</dt>
<dd>While lying on my back to make</dd>
<dd>An angel in the snow</dd>
<dd>I saw a greenish graft appear!</dd>
<dd>A giant UFO!</dd>
<dd> </dd>
<dd>A strange, unearthly hum it made!</dd>
<dd>It hovered overhead!</dd>
<dd>And aliens were moving 'round</dd>
<dd>In view ports glowing red!</dd>
<dd> </dd>
<dd>I tried to run for cover, but</dd>
<dd>A hook that they had low'r'd</dd>
<dd>Snagged me by my overcoat</dd>
<dd>And hoisted me aboard.</dd>
<dd> </dd>
<dd>Even then, I tried to fight</dd>
<dd>And though they numbered many,</dd>
<dd>I poked them in their compound eyes</dd>
<dd>And pulled on their antennae!</dd>
<dd> </dd>
<dd>It was no use! They dragged me to </dd>
<dd>A platform, tied me up,</dd>
<dd>And wired to my cranium</dd>
<dd>A fiendish suction cup!</dd>
<dd> </dd>
<dd>They turned it on and current coursed</dd>
<dd>Across my cerebellum</dd>
<dd>Coaxing from my brain tissue</dd>
<dd>The things I wouldn't tell 'em!</dd>
<dd> </dd>
<dd>All the math I ever learned,</dd>
<dd>The numbers and equations,</dd>
<dd>Were mechanic'ly removed in this</dd>
<dd>Brain-draining operation!</dd>
<dd> </dd>
<dd>My escape was an adventure.</dd>
<dd>(I won't tell you what I did.)</dd>
<dd>Suffice to say, I cannot add,</dd>
<dd>So ask some other kid.</dd>
</dl>
<p>Back to the <a href="#top">top</a></p>
<div id="footer">
<p><a href="calvinbuy.php"><img src="images/newcalbuy.gif" alt="Buy Calvin and Hobbes" /></a></p>
<?php include ("bar.php"); ?>
<p><img src="/cgi-sys/Count.cgi?df=calvin.dat|display=Counter|ft=6|md=5|frgb=100;139;216|dd=C" alt="counter" /></p>
</div>
</body>
</html>
This is the error I am receiving:
Error Line 77 column 5: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<br />
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>").
I think that there must be something else wrong with my code, but I cannot find it. Can anyone tell me why I am getting this error with <br />?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<!-- all html written by Dorienne Smith -->
<head>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="home.css" type="text/css" />
<meta name="keywords" content="dorienne smith, calvin and hobbes, calvin, hobbes, bill watterson, comics, downloads, pictures, images, gifs, books, facts, poetry" />
<meta name="description" content="Midnight Calvin - For those whose midnight pastime is re-discovering the beloved comic Calvin and Hobbes" />
<meta name="owner" content="kaitco@doriennesmith.com" />
<meta name="author" content="Dorienne Smith" />
<meta http-equiv="content-language" content="English" />
<meta name="rating" content="General" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Poetry - Midnight Calvin -- Dorienne Smith.com</title>
<style type="text/css">
html, body {
color: #fff;
background: #000;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
}
a {
color: #fff;
}
a img {
border-style: none;
}
ul {
list-style: none;
font-size: 12px;
text-align: center;
}
li {
display: inline;
}
h1 {
text-align: center;
}
dl {
padding: 1em 0;
}
dt {
font: normal large Verdana, Arial, Helvetica, sans-serif;
}
dd {
font: normal small Tahoma, Arial, Helvetica, sans-serif;
}
p {
font: medium, Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
}
#footer {
text-align: center;
}
</style>
</head>
<body>
<?php include ("nav.php"); ?>
<h1><a id="top"><img src="images/players/newpoetry.gif" alt="Poetry" /></a></h1>
<br />
<ul>
<li><a href="#alien">Alien Brain Drain</a></li>
<li><a href="#mind">Exploring Mind</a></li>
<li><a href="#mum">My Mom and Dad</a></li>
<li><a href="#night">Nauseous Nocturne</a></li>
<li><a href="#sixmas">Six Days 'Til Christmas</a></li>
<li><a href="#trex">The Tyrannosaur</a></li>
<li><a href="#water">Water-Stealing Blue Collar Work</a></li>
<li><a href="#eve">Christmas Eve</a></li>
</ul>
<dl>
<dt><a id="alien">Alien</a> Brain Drain</dt>
<dd>While lying on my back to make</dd>
<dd>An angel in the snow</dd>
<dd>I saw a greenish graft appear!</dd>
<dd>A giant UFO!</dd>
<dd> </dd>
<dd>A strange, unearthly hum it made!</dd>
<dd>It hovered overhead!</dd>
<dd>And aliens were moving 'round</dd>
<dd>In view ports glowing red!</dd>
<dd> </dd>
<dd>I tried to run for cover, but</dd>
<dd>A hook that they had low'r'd</dd>
<dd>Snagged me by my overcoat</dd>
<dd>And hoisted me aboard.</dd>
<dd> </dd>
<dd>Even then, I tried to fight</dd>
<dd>And though they numbered many,</dd>
<dd>I poked them in their compound eyes</dd>
<dd>And pulled on their antennae!</dd>
<dd> </dd>
<dd>It was no use! They dragged me to </dd>
<dd>A platform, tied me up,</dd>
<dd>And wired to my cranium</dd>
<dd>A fiendish suction cup!</dd>
<dd> </dd>
<dd>They turned it on and current coursed</dd>
<dd>Across my cerebellum</dd>
<dd>Coaxing from my brain tissue</dd>
<dd>The things I wouldn't tell 'em!</dd>
<dd> </dd>
<dd>All the math I ever learned,</dd>
<dd>The numbers and equations,</dd>
<dd>Were mechanic'ly removed in this</dd>
<dd>Brain-draining operation!</dd>
<dd> </dd>
<dd>My escape was an adventure.</dd>
<dd>(I won't tell you what I did.)</dd>
<dd>Suffice to say, I cannot add,</dd>
<dd>So ask some other kid.</dd>
</dl>
<p>Back to the <a href="#top">top</a></p>
<div id="footer">
<p><a href="calvinbuy.php"><img src="images/newcalbuy.gif" alt="Buy Calvin and Hobbes" /></a></p>
<?php include ("bar.php"); ?>
<p><img src="/cgi-sys/Count.cgi?df=calvin.dat|display=Counter|ft=6|md=5|frgb=100;139;216|dd=C" alt="counter" /></p>
</div>
</body>
</html>