By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

HTML Validation.... Is it Imperative?

tharden3
100+
P: 916
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>").
Sep 4 '08 #1
Share this Question
Share on Google+
9 Replies


eWish
Expert 100+
P: 971
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
Sep 4 '08 #2

tharden3
100+
P: 916
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?
Sep 4 '08 #3

eWish
Expert 100+
P: 971
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
Sep 4 '08 #4

drhowarddrfine
Expert 5K+
P: 7,435
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.
Sep 4 '08 #5

Expert 100+
P: 397
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?
Sep 4 '08 #6

tharden3
100+
P: 916
link
I'm open to suggestions
Sep 4 '08 #7

Expert 100+
P: 397
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
Sep 4 '08 #8

Dormilich
Expert Mod 5K+
P: 8,639
what about "display: block;" ?
Sep 4 '08 #9

tharden3
100+
P: 916
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
Sep 4 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.