W3C Validation: Attribute alt not allowed on element a at this point
Asked Answered
B

2

8

While running through the W3C validation service, I encountered this error message:

Attribute alt not allowed on element a at this point.

The validator complains after the "Four Fortune 500 Companies reside: " content. Here is my HTML markup:

<div id="container">
    <header>
        <h1><a href="index.html">Metropolitan+<b>Seattle</b></a></h1>
        <nav>
            <ul>
                <li><a href="buildings.html">Buildings</a></li>
                <li id="contact">Contact Us</li>
            </ul>
        </nav>
    </header>
</div>
<div class="image-section">
    <img src="img/seattleskyline.jpg" alt="Seattle Skyline" id="center-image" />
    <div id="caption"><div id="caption-text">A panoramic view of 1201 Third Avenue at night</div></div>
    <button id="sliderLeft" onclick="left();"></button>
    <button id="sliderRight" onclick="right();"></button>
</div>
<br><br>
    <div class="content">
        Four Fortune 500 companies reside: 
<a href="http://www.amazon.com/"alt="Amazon Website"><b>Amazon.com (#49)</b>
</a>, <a href="http://www.starbucks.com" alt="Starbucks Website"><b>Starbucks (#208)</b></a>, <a href="http://shop.nordstrom.com" alt="Nordstrom Website"><b>Nordstrom (#227)</b></a>, and <a href="http://www.expeditors.com" alt="Expeditors Website"><b>Expeditors International (#428)</b></a>. 
    </div>
    <br><br>
Babblement answered 24/5, 2015 at 6:24 Comment(2)
alt it's not allowed in a element, use title instead altVarney
See also: Is it correct to use alt tag for an anchor link?Collimator
D
7

You want to use title attribute, not alt.

Disrepute answered 24/5, 2015 at 6:26 Comment(0)
L
1

For anchor tag, alt is not a valid attribute, please use title attribute.

Please refer http://www.w3.org/TR/html4/struct/links.html

Ligurian answered 24/5, 2015 at 6:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.