在W3C validation service
中运行时,我遇到了以下错误消息:
此时元素a上不允许使用属性alt。
验证人在四家财富500强企业居住后抱怨:"内容。这是我的HTML
标记:
<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>
答案 0 :(得分:3)
您想使用title
属性,而不是alt
。
答案 1 :(得分:0)
对于锚标记,alt不是有效属性,请使用title属性。