Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-05-2011, 06:04 PM   PM User | #1
voloproductions
New Coder

 
Join Date: Sep 2010
Posts: 45
Thanks: 2
Thanked 2 Times in 2 Posts
voloproductions is an unknown quantity at this point
Post XHTML Validation Error

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?
voloproductions is offline   Reply With Quote
Old 04-05-2011, 06:16 PM   PM User | #2
teedoff
Senior Coder

 
Join Date: Aug 2010
Location: High Point, NC
Posts: 3,325
Thanks: 5
Thanked 363 Times in 360 Posts
teedoff is on a distinguished road
If you read all the validation explainations the valdiator gives, you can see whats wrong:

Quote:
…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.
__________________
Teed
teedoff is offline   Reply With Quote
Old 04-05-2011, 06:54 PM   PM User | #3
voloproductions
New Coder

 
Join Date: Sep 2010
Posts: 45
Thanks: 2
Thanked 2 Times in 2 Posts
voloproductions is an unknown quantity at this point
Quote:
Originally Posted by teedoff View Post
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.
voloproductions is offline   Reply With Quote
Old 04-05-2011, 06:59 PM   PM User | #4
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by voloproductions View Post
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
oesxyl is offline   Reply With Quote
Old 04-05-2011, 06:59 PM   PM User | #5
teedoff
Senior Coder

 
Join Date: Aug 2010
Location: High Point, NC
Posts: 3,325
Thanks: 5
Thanked 363 Times in 360 Posts
teedoff is on a distinguished road
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.
__________________
Teed
teedoff is offline   Reply With Quote
Users who have thanked teedoff for this post:
voloproductions (04-05-2011)
Old 04-05-2011, 07:07 PM   PM User | #6
voloproductions
New Coder

 
Join Date: Sep 2010
Posts: 45
Thanks: 2
Thanked 2 Times in 2 Posts
voloproductions is an unknown quantity at this point
the span tag did what I was trying to accomplish. All fixed now.
voloproductions is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:08 PM.


Advertisement
Log in to turn off these ads.