gohankid77
Technical User
I created the following to make a navigation sidebar.
Now the problem is that this does not validate for XHTML 1.0 Transitional. The problem would be the <div> in between the <a></a>. I understand that I cannot have a block level element like the <div> in an inline element like the <a>. However, I can't think of any other way to get the effect I want. I suspect I might need to use javascript, but I'm hoping not to go there cause I know nothing about it.
I'm hoping someone can give me a XHTML solution to the problem! Thanks for any help!
"Ships that pass in the night and speak each other in passing;
Only a signal shown and a distant voice in the darkness;
So on the ocean of life we pass and speak one another,
Only a look and a voice; then darkness again and a silence."
- Henry Wadsworth Longfellow
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
<head>
<title>navigation bar problem</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
.div_nav { /* navigation bar */
width: 100px;
float: left;
border-right: none;
background-color: black;
}
.navLink {
padding: 2px;
padding-left: 5px;
border-left: 2px solid black;
border-bottom: 1px solid black;
background-color: #3C2A36 !important;
font: 10px "Lucida Sans Unicode", Verdana, Arial, Sans-serif; color: #F0F0F0;
text-decoration: none;
text-align: left;
cursor: pointer;
}
.navOver {
padding: 2px;
padding-left: 5px;
border-left: 2px solid black;
border-bottom: 1px solid black;
background-color: #3C2A36 !important;
font: bold 10px "Lucida Sans Unicode", Verdana, Arial, Sans-serif; color: #F0F0F0;
text-align: left;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<div class="div_nav">
<a href="#" title="To The Splash Page"><div style="border-top: 2px solid black;" class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">home</div></a>
<a href="#" title="Site News"><div class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">site</div></a>
<a href="#" title="Rants, Life, and The Hard Truth"><div class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">blog</div></a>
<a href="#" title="About Me"><div class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">about</div></a>
<a href="#" title="Pictures"><div class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">galleria</div></a>
<a href="#" title="Favourite Links"><div class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">link</div></a>
<a href="#" title="Email Me"><div style="border-bottom: 2px solid black" class="navLink" onmouseover="this.className='navOver'" onmouseout="this.className='navLink'">contact</div></a>
</div>
</body>
</html>
Line 51, column 175: document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag
...onmouseout="this.className='navLink'">home</div></a>
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>").
Now the problem is that this does not validate for XHTML 1.0 Transitional. The problem would be the <div> in between the <a></a>. I understand that I cannot have a block level element like the <div> in an inline element like the <a>. However, I can't think of any other way to get the effect I want. I suspect I might need to use javascript, but I'm hoping not to go there cause I know nothing about it.
I'm hoping someone can give me a XHTML solution to the problem! Thanks for any help!
"Ships that pass in the night and speak each other in passing;
Only a signal shown and a distant voice in the darkness;
So on the ocean of life we pass and speak one another,
Only a look and a voice; then darkness again and a silence."
- Henry Wadsworth Longfellow