...

View Full Version : XHTML Validation Error



voloproductions
04-05-2011, 06:04 PM
Doc Type:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

The Code:

<li><a href="#" id="M1"><div class="alignment">RESTURANT<br />EQUIPMENT</div></a></li>
<li><a href="#">SMALLWARES</a></li>
<li><a href="#" id="M3"><div class="alignment">STORAGE/<br />TRANSPORT</div></a></li>
<li><a href="#">TABLETOP</a></li>
<li><a href="#">DISPOSABLES</a></li>
<li><a href="#">FURNITURE</a></li>
<li><a href="#">CONSUMABLES</a></li>
<li class="last-child"><a href="#" id="M8"><div class="alignment">JANITORIAL<br />SUPPLIES</div></a></li>

Errors:

document type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag


So how can I write the above HTML to be valid? I need the div's to help control the double line menu... If I put padding on the a tag then my house over image get's padded down so any solution to this so I can have valid code?

teedoff
04-05-2011, 06:16 PM
If you read all the validation explainations the valdiator gives, you can see whats wrong:


…href="#" id="M1"><div class="alignment">RESTURANT<br />EQUIPMENT</div></a></li>✉
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>").


You cant place a block level element within an inline element.

You also dont have an opeing and closing <ul></ul> tag.
Unless you left them out here in your post.

Now what exactly do you mean by double line menu? Do you mean Drop Down? if so there are many many tutorials to create CSS based DD menus online.

voloproductions
04-05-2011, 06:54 PM
If you read all the validation explainations the valdiator gives, you can see whats wrong:



You cant place a block level element within an inline element.

You also dont have an opeing and closing <ul></ul> tag.
Unless you left them out here in your post.

Now what exactly do you mean by double line menu? Do you mean Drop Down? if so there are many many tutorials to create CSS based DD menus online.

I just left out the ul tags... and I understand whats causing the issue I am just not sure what to do in order to fix it.

oesxyl
04-05-2011, 06:59 PM
I just left out the ul tags... and I understand whats causing the issue I am just not sure what to do in order to fix it.
very simple, span is also a container, so use span instead of div, :)

best regards

teedoff
04-05-2011, 06:59 PM
Thats why I asked what you meant by double line menu? Take out the div tags to fix the validation errors first. You could use the span tag in place of it. Then explain what you're trying to accomplish with this menu or what your desired result should be.

voloproductions
04-05-2011, 07:07 PM
the span tag did what I was trying to accomplish. All fixed now.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum