Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:45

W3C will not validate my menu with <br>


Poster: mark1
Dated: Tuesday May 3 2005 - 13:42:14 BST

Hi I want to have a line break and indent on a couple of menu items. Easy enough <br />&nbsp;&nbsp;. Problem is I get an error message when validating the page.
Do I have another option? I tried &lt;br /&gt; ang got more errors when validating the page.
Quote:
Line 67, column 30: document type does not allow element "br" here

aI("text=Education<br />&nbsp;&nbsp;&nbsp;Programs;showmenu=education;");

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).



Thanks
Mark


Poster: BigWebGuy
Dated: Tuesday May 3 2005 - 14:50:30 BST

you need to escape your / with a \ like below:

Code:
aI("text=Education<br \/>&nbsp;&nbsp;&nbsp;Programs;showmenu=education;");


same if you would need to output double quotes:

Code:
aI("text=\"Education<br \/>&nbsp;&nbsp;&nbsp;Programs\";showmenu=education;");


Poster: mark1
Dated: Tuesday May 3 2005 - 19:27:05 BST

Thanks GigWebGuy This gave me quotes in the menu and this error message when validating. I have also tried "li". It works but I get the same error message with the exception "br" is now "li".

Quote:
Line 67, column 31: document type does not allow element "br" here

aI("text=\"Education<br \/>&nbsp;&nbsp;&nbsp;Programs\";showmenu=educatio

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).


Poster: John
Dated: Tuesday May 3 2005 - 23:10:26 BST

It's not your code (obviously). It's simply that the checker does not understand the syntax of the aI statement, which, not being XHTML, gets flagged (in this case because the <br /> is "out of place").


Poster: mark1
Dated: Tuesday May 3 2005 - 23:53:29 BST

Thanks John

Well it works as coded so leave well enough alone :)
Quote:
Don't fix it if it ain't broke


Thanks for everyone's help and the great menu system.

Mark


Poster: John
Dated: Wednesday May 4 2005 - 15:32:07 BST

You're welcome, Mark.

I've run into the same problem. If you're not getting validation errors anywhere else in your code you know you're 'clean'.


Poster: kevin3442
Dated: Tuesday May 10 2005 - 1:09:19 BST

What doctype are you using? Would it be because <br> is depreciated for your particular doctype?

Did you try just a plain ol <br> without the slash?

Random thoughts...

Kevin