【发布时间】:2013-08-19 14:54:08
【问题描述】:
我的日子有点难过。我创建了一些图标放在一些链接旁边。链接在悬停时具有“下划线”文本装饰效果。我添加了图标,它非常适合,只是当锚标签悬停时图标没有下划线。我做错了什么?
HTML
<a class="link" href="#">
<img src="images/home.png" alt="" id="home" class="icon"/>
home
</a>
<a class="link" href="about/">
<img src="images/about.png" alt="" id="about" class="icon"/>
About
</a>
<a class="link" href="contact/">
<img src="images/contact.png" alt="" id="contact" class="icon"/>
Contact
</a>
<a class="link" href="work/">
<img src="images/work.png" alt="" id="work" class="icon"/>
Work
</a>
CSS
#home {
width: 15px;
height: 15px;
}
#about {
width: 15px;
height: 15px;
}
#contact {
width: 19px;
height: 15px;
}
#work {
width: 16px;
height: 15px;
}
.link {
margin: 0;
padding: 0;
display: inline-block;
line-height: 50px;
width: 100px;
font-size: 18px;
font-family: arial;
}
.link:link {
color: #ffffff;
font-weight: bold;
text-decoration: none;
}
.link:visited {
color: #ffffff;
font-weight: bold;
text-decoration: none;
}
.link:active {
color: #ffffff;
font-weight: bold;
text-decoration: none;
}
.link:hover {
color: #ffffff;
font-weight: bold;
text-decoration: underline;
}
感谢您的帮助。
【问题讨论】: