Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Responsive Web Design and Testing Website Testing

Francesco Vitale
Francesco Vitale
4,962 Points

Hi, I can I fix these validation errors regarding the ALT attributes in HREF tags:

Error: Attribute alt not allowed on element a at this point. From line 37, column 19; to line 37, column 54 <a href="img/numbers-01.jpg" alt=""> ↩

Error: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. From line 38, column 19; to line 38, column 48 <img src="img/numbers-01.jpg">↩

Error: Attribute alt not allowed on element a at this point. From line 44, column 19; to line 44, column 54 <a href="img/numbers-02.jpg" alt=""> ↩

Error: An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. From line 45, column 19; to line 45, column 48 <img src="img/numbers-02.jpg">↩

2 Answers

Liam English
Liam English
3,837 Points

As James has said above, alt attributes go inside img tags. for anchor tags you should use the title attribute instead.

Example:

<img src="#" alt="alt text">

<a href="#" title="title text">anchor text</a>