I am trying to make a menu with images only. Can anyone tell me how I should markup this in the most semantic way possible? My best guess would be like this:
HTML
<ul>
<li><a href="#" class="menu" alt="homepage" id="home"></a></li>
</ul>
CSS
.menu {width: 40px; height: 40px}
#home {background: url('...')
EDIT: The query is because Ineed to use empty <a>
tags or alternatively I can put the <img>
tag within the <a>
tags.
<nav>
tag.alt=""
should be replaced by a title=""
attribute on the <a>
tag (MDN for more info)<img>
tag with the alt=""
attribute so you can add more semantic context.Your menu could look like this:
<nav>
<ul>
<li><a href="" title=""><img src="" alt="" /></a></li>
... OTHER LINKS ...
</ul>
</nav>