Connecting Tech Pros Worldwide Forums | Help | Site Map

HTML Validation.... Is it Imperative?

tharden3's Avatar
Site Addict
 
Join Date: Jul 2008
Location: Ocala, FL (United States)
Posts: 817
#1: Sep 4 '08
My site is HTML Valid by the W3C for all but one error. You see, to make a really great navigation bar in my left column, I added the <p> attribute to the text in-between an <a href=""></a> link attribute. I did this so that I would have better control over the text. The trick works, and it looks and functions great in every browser, but does not pass Validation standards. Your not supposed to have <p>, a block-line attribute, inside of
<a href=""></a>, an in-line attribute. It's not hurting anyone, and like I said, it works and looks fine. Do I absolutely need validation?

P.S. If you didn't get what I was talking about...
What I did looks like this:
[HTML]<a href="http://www.htmldog.com"><p>Games</p></a>[/HTML]

And the W3C said I was being naughty:

Line 23, Column 66: document type does not allow element "p" here; missing one of "object", "ins", "del", "map", "button" start-tag.
…links" id="dos"><a href="http://www.htmldog.com"><p>Games</p></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>").

eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#2: Sep 4 '08

re: HTML Validation.... Is it Imperative?


Validation is very imperative. It is a must have tool when designing websites that you would like to render correctly. As for the error you have posted simply remove the <p> and </p> around the Link Name.

When you use the <p> tag's you are telling the browser that you are going to have a paragraph. A single word in my opinion should not be considered a paragraph. I guess that I missed the trick that you are wanting to achieve with the use of the paragraph tag.

--Kevin
tharden3's Avatar
Site Addict
 
Join Date: Jul 2008
Location: Ocala, FL (United States)
Posts: 817
#3: Sep 4 '08

re: HTML Validation.... Is it Imperative?


Quote:

Originally Posted by eWish

Validation is very imperative. It is a must have tool when designing websites that you would like to render correctly. As for the error you have posted simply remove the <p> and </p> around the Link Name.

When you use the <p> tag's you are telling the browser that you are going to have a paragraph. A single word in my opinion should not be considered a paragraph. I guess that I missed the trick that you are wanting to achieve with the use of the paragraph tag.

--Kevin

Yes, but why. If everything is working correctly in every browser, and everyone else on the planet is ok with it besides the W3C, then it's ok right?
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#4: Sep 4 '08

re: HTML Validation.... Is it Imperative?


I am not certain about the specifics and only know what I have read. Doing some things (this being one of them) is not considered good structure. I hope that either Doc, David or any other expert will have a better answer for you.

--Kevin
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,577
#5: Sep 4 '08

re: HTML Validation.... Is it Imperative?


1) There is no guarantee that all browsers will handle the same error the same way.
2) It works today but there is no guarantee it will work when the next version of any browser comes out.
3) This error disrupts the layout in the DOM. If you were to ever use javascript to do any manipulation, you may not be able to follow the structure properly to get to that or other elements.
4) You are relying on an error to make your page work. You do not need to apply one error to make another error work.
Expert
 
Join Date: Aug 2008
Posts: 397
#6: Sep 4 '08

re: HTML Validation.... Is it Imperative?


Provide a clickable link to the page. Perhaps someone on the forum can offer a different menu construct that is valid and will look and work as well if not better than what you got?
tharden3's Avatar
Site Addict
 
Join Date: Jul 2008
Location: Ocala, FL (United States)
Posts: 817
#7: Sep 4 '08

re: HTML Validation.... Is it Imperative?


link
I'm open to suggestions
Expert
 
Join Date: Aug 2008
Posts: 397
#8: Sep 4 '08

re: HTML Validation.... Is it Imperative?


Quote:

Originally Posted by tharden3

link
I'm open to suggestions

A suggestion for a place to start was given yesterday. See at bottom of your thread/post: screen resolution-- #8
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,660
#9: Sep 4 '08

re: HTML Validation.... Is it Imperative?


what about "display: block;" ?
tharden3's Avatar
Site Addict
 
Join Date: Jul 2008
Location: Ocala, FL (United States)
Posts: 817
#10: Sep 4 '08

re: HTML Validation.... Is it Imperative?


Quote:

Originally Posted by David Laakso

A suggestion for a place to start was given yesterday. See at bottom of your thread/post: screen resolution-- #8

ahh, true true. Thanks for the help
Reply