如何为静态背景图像创建悬停效果…

How to create a hover effect for static background images...?

本文关键字:悬停 创建 图像 静态 背景      更新时间:2023-09-26

我不是一个js家伙,但我正试图找到一种方法,使一个"气泡"出现在它的内容,当访问者鼠标在背景图像。HTML看起来像这样:

<div id="certifications">
        <p class="gold left">Microsoft Gold Partner</p>
        <p class="sdvo center">Service Disabled Veteran Owned Small Business</p>
        <p class="ibm right">IBM Authorized Partner</p>
</div><!-- end #certifications -->

控制该区域的CSS看起来是这样的

#certifications {
height: 111px;
clear: both;
width: 100%;
margin-top: 20px;
margin-bottom: 20px;
margin-left: 40px;
}
#certifications p {
margin-top: 20px;
text-indent: -9999px;
}
#certifications .gold {
background-image: url(images/microsoft-gold.jpg);
background-repeat: no-repeat;
display: inline;
height: 70px;
width: 33%;
float: left;
margin-top: 25px;
padding: 0;
}
#certifications .sdvo {
background-image: url(images/sdvosb.png);
background-repeat: no-repeat;
display: inline;
height: 100px;
width: 30%;
float: left;
margin-left: 20px;
}
#certifications .ibm {
background-image: url(images/partners/IBM.png);
background-repeat: no-repeat;
display: inline;
height: 99px;
width: 31%;
margin-top: 25px;
margin-left: -50px;
}

当有人将鼠标放在三个背景图像中的任何一个上时,我希望效果出现(理想情况下只使用CSS,但如果我需要使用JS,那么这不是什么大问题)。关键是要使它向后兼容IE6。

我将继续研究这个问题,如果我找到答案,我会发布,但我真的很感激你们可能提供的任何见解。感谢您的时间和见解!

我喜欢偷懒编码,不喜欢重复工作。这些家伙已经用了十几种不同的方法。http://www.1stwebdesigner.com/css/stylish-jquery-tooltip-plugins-webdesign/