Is using <img> for a menu item wrong?
<div class="dashboard-icon">
<a href="./structure/">
<img class="admin-icon" src="<?=inc_path;?>images/icons/home.png" alt="" /></a><br />
<p开发者_StackOverflow>Dashboard</p>
</div>
This is part of a menu, do you think it would be better in a UL > LI? I want a label underneath the icon.
Trying to think of reasons if this is bad or not. :)
Is using
<img>
for a menu item wrong?
Not if it is a content image (e.g. an icon).
This is part of a menu, do you think it would be better in a UL > LI?
Menus are, typically, lists of links, and using <ul>
and <li>
would be appropriate. That won't prevent you from using an <img>
though.
<p>Dashboard</p>
A text description for an image probably doesn't deserve its own paragraph though. I'd set display: block
on the image if I wanted to force a line break, and put the text inside the <a>
so the entire thing is clickable. I certainly wouldn't use a line break and a paragraph. Use margin
for spacing.
精彩评论