The "a" element contains no link text

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 1
Joined: Sat Feb 07, 2015 8:36 am

The "a" element contains no link text

Post by tcloud »

Running v. 14

I need to figure out why my "Evidence Locker" page is losing justification -- main.content p tags should all be justified:

The page is large (because there is a lot of evidence) -- there are too many warnings about "The "a" element contains no link text" such that it terminates checking:
"Terminating validation due to too many warnings. Please correct the warnings and recheck the document. HTML Validator is currently set to stop checking after 60 warnings."

What's frustrating is all of those "a" elements have an image as their target. IOW, the anchor tag is not empty, it just doesn't have any link text.

How do I get validator to recognize _any_ content in the a tag? Failing that, how do I disable the warnings so I can see whatever else may be problematic in the page?


User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3481
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: The "a" element contains no link text

Post by Albert Wiersch »

Hello and welcome to the forum!

If you use the "alt" attribute with those "img" elements then CSE HTML Validator will consider the container "a" elements as having link text. I highly recommend you add the "alt" attribute to all images. Regarding "alt" text, CSE HTML Validator says: The "alt" attribute is critical for accessibility and useful for SEO. It may only be omitted when no alternative text is available and none can be made available. NOTE: Alternate text should not change the meaning of the page when it is used to replace the image, and it should not be supplemental text, like a caption, title, or legend (because it's replacement text; consider the "title" attribute for supplemental text). It should also not repeat information that is provided in the prose next to the image.

The above solution is best, but you can still disable those messages if you don't want to see them. Here is more information on disabling messages:
How to Disable Validator Messages
Disabling Validator Messages

I hope this helps!

Post Reply