Reputation: 877
I ran my website in the w3 validator and got this error...
Line 16, Column 4: End tag a violates nesting rules.
</a>
What is the problem? I worked hard to write good markup and only got 2 errors, the other error I fixed, but this one I just can't work out...
Upvotes: 0
Views: 23400
Reputation: 20
If possible please share your code. I think you are using a tag under a tag. You have to use single a tag.
<a href="">
<ul>
<li><a href="">A</a></li>
<li><a href="">B</a></li>
</ul>
</a>
Upvotes: -2
Reputation: 29
A bit late but can be useful for others !!
In the "nesting rules" you can't open a tag and then open another tag in it but closing it outside the first tag!!
hahaha sound not so clear!! An example is better than thousand words, so:
This will give you a nesting rules error !!
...blabla <em><b>blibloblu</em></b> blablabla....
While this is correct !!
...blabla <em><b>blibloblu</b></em> blablabla....
Hopefully that will help some !!
Upvotes: 0
Reputation: 168685
It means that you have mis-matched tags.
For example, the following code will throw the error described:
<a href=''><b>Some text</a></b>
Given that you made a point to state that you'd tried to write good markup and that you don't have any other errors, I guess you know that already, so what could be causing it.
My guess is that you've got a tag which isn't being closed properly inside your <a>
tag.
For example, in the example I gave above, you might have the closing </b>
tag in the right place, but maybe have a typo with it that stops it being recognised as a closing tag - eg maybe missing the slash? That would be the most plausible, and easy to miss.
Or another example -- maybe you've got code like this:
<a href=''><img src='pic.jpg'></a>
In an HTML document, the above code is perfectly valid. However, if you've specified your <DOCTYPE>
as xhtml it is invalid, because in xhtml all tags need to be closed, and the <img>
above isn't. It would need a closing slash added to it like this:
<a href=''><img src='pic.jpg' /></a>
My guess is that your error is something along these lines.
You haven't shown us the code that is generating the errors, so I'm shooting in the dark a bit here, but that is my guess.
I would also say that while the W3C's validator is an excellent resource, if you're using a decent IDE to write your code, the code editor should highlight any syntax errors like this for you while you're writing the code. That would make it very easy to see the problem. Even some browsers' View Source feature will show you syntax highlighting which may reveal the problem.
Upvotes: 13