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>
Henry Zhu
  • 2,488
  • 9
  • 43
  • 87

2 Answers2

7

You want to use title attribute, not alt.

Andrew
  • 18,680
  • 13
  • 103
  • 118
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

Sashant Pardeshi
  • 1,075
  • 7
  • 21