【发布时间】:2012-11-21 14:00:09
【问题描述】:
我有一些指向我的 facebook 和 twitter 的链接,这些链接是图片。当我将鼠标悬停在它们上面时,我希望这些链接变亮。我想我可以通过制作两张图像并在我将鼠标悬停在图像链接上时改变图像来做到这一点。这是最好的方法吗?如果是我该怎么做?我找不到任何关于如何做到这一点的帮助。
这是我的 HTML:
<div class="social">
<a href="https://www.facebook.com/seth.urquhart?sk=wall&v=wall">
<img src="../img/facebook_logo_extended.jpg"/>
</a>
</div>
<br>
<div class="social">
<a href="https://twitter.com/SethUrquhart">
<img src="../img/twitter_logo_extended.jpg"/>
</a>
</div>
这是我的 CSS:
p {
color: #232323;
text-indent:0px;
margin-left:30px;
padding-right: 30px;
}
ul {
text-align: center;
color: gray;
}
ul a {
text-decoration: none;
color: black;
}
ul a:hover {
text-decoration: underline;
margin-right: auto;
margin-left: auto;
}
html {
background: #e8e9e1;
}
h1 {
text-align: center;
}
body {
font-family: sans-serif;
color: #232323;
}
.wrap {
min-width: 600px;
width: 1200px;
margin: auto;
height: 100px;
text-align: center;
background-color: none;
}
.content {
background: #ffffff;
width: 900px;
margin-left: auto;
margin-right:auto;
height: auto;
text-indent: 50px;
}
.footer {
text-align: center;
background-color: #383838;
width: 900px;
margin-left: auto;
margin-right: auto;
color: #e8e9e1;
}
.social {
width: 900px;
margin: auto;
height: 100px;
text-align: center;
background-color: none;
}
.social:hover {
margin-right: auto;
margin-left: auto;
background:#cccccc;
color:#000;
}
ul#list-nav {
padding: 0;
list-style: none;
width: 605px;
margin: 0 auto;
}
ul#list-nav li {
display:inline;
}
ul#list-nav li a {
text-decoration:none;
padding:5px 0;
width:150px;
background:#383838;
color:#eee;
float:left;
border-left:1px solid #fff;
}
ul#list-nav li a:hover {
margin-right: auto;
margin-left: auto;
background:#cccccc;
color:#000;
}
【问题讨论】:
-
css3 过渡怎么样? w3schools.com/css3/css3_transitions.asp
-
@vucko 所说的 CSS3 过渡,或 jQuery UI 效果 (jqueryui.com/effect)。
-
密集是指更轻。比原始图像更亮的图像,更少的颜色比原始颜色更苍白。示例:第一张图片=蓝色,第二张图片=浅蓝色。
标签: html css image hyperlink hover