【问题标题】:Div with image clickable and with hover具有可点击图像和悬停功能的 Div
【发布时间】:2012-01-07 18:34:54
【问题描述】:

我想在我的 html 页面中添加一个可点击的图像,带有不透明度,当我将鼠标悬停在图像上时,不透明度必须更改为 0。(带有:悬停)

我尝试了不同的方法,但没有一种有效..

谁能给我代码?

我找到了解决问题的方法:

<html>
<div id="yourdiv">
<a href="#">
<img src="images/yourimage.png" width="20" height="20" alt="..." />
</a>
</div>

</html>

<style>
#yourdiv img{
opacity:0.5;
filter:alpha(opacity=50); /* For IE8 and earlier */
}

#yourdiv img:hover{
opacity:1.0;
filter:alpha(opacity=100); /* For IE8 and earlier */
}

</style>

【问题讨论】:

  • 你尝试过什么?纯 css 或一些 javascript。

标签: html css image hover


【解决方案1】:

您是否尝试过至少用谷歌搜索您的问题? 好像不是...

http://www.webdesign.org/html-and-css/tutorials/images-with-hover-effects.9130.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-29
    • 1970-01-01
    • 1970-01-01
    • 2013-04-30
    相关资源
    最近更新 更多