简体   繁体   中英

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

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>

您想使用title属性,而不是alt

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM