三九宝宝网宝宝绘画儿童画

css中如何定义鼠标经过改变图片

02月28日 编辑 39baobao.com

[怎么用CSS或者JS实现鼠标点击变换背景图片]<img src="1.jpg" width="100" height="100" alt="" onclick="pf(this)"/> <script type="text/javascript"> var arr = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg"]; function pf(t) { t.src = ar...+阅读

从原理说起吧:激活的、已访问的、未访问的或者当有鼠标悬停在其上的链接,它们会在支持 CSS 的浏览器中以不同的方式显示出来,样式如下:

1. a:link {background:url(images/bg1.jpg) no-repeat 0 0;} /* 未访问的链接 */

2. a:visited {background:url(images/bg1.jpg) no-repeat 0 0;} /* 已访问的链接 */

3. a:hover {background:url(images/bg1.jpg) no-repeat 0 0;} /* 当有鼠标悬停在链接上 */

4. a:active {background:url(images/bg1.jpg) no-repeat 0 0;} /* 被选择的链接 */

在其中设置你想要的背景图片吧,如果是4个不同的图片,你就会看到4种不同状态下的效果。

css鼠标经过图片切换效果在IE浏览器可以在火狐就没效果了呢而且

background里面-160这些都要加上单位才行 .new_bottom03{ width:110px; height:160px; float:left; margin-left:20px; padding:0; } .new_bottom03 a{ display:block; width:110px; height:160px; background:url(1.jpg) no-repeat 0 -160px; margin:0; padding-top:170px; overflow:hidden; } .new_bottom03 a:hover{background:url(1.jpg) no-repeat -110px -160px;}

CSS鼠标经过时改变背景图片

#tabs10 {

float:left;

width:100%;

font-size:93%;

line-height:normal;

}

#tabs10 ul {

margin:0;

padding:0px 0px 0 0px;

list-style:none;

}

#tabs10 li {

display:inline;

margin:0;

padding:0;

}

#tabs10 a {

float:left;

background:url("图片1.gif") no-repeat left top;

margin:0;

padding:0 0 0 4px;

text-decoration:none;

}

#tabs10 a span {

float:left;

display:block;

background:url("图片2.gif") no-repeat right top;

padding:5px 12px 5px 12px;

color:#FFF;

}

/* Commented Backslash Hack hides rule from IE5-Mac \*/

#tabs10 a span {float:none;}

/* End IE5-Mac hack */

#tabs9 a:hover span {

color:#FFF;

}

#tabs10 a:hover {

background-position:0% -42px;

}

#tabs10 a:hover span {

background-position:100% -42px;

}

以下为关联文档:

如何用CSS实现鼠标移动到某张图片时变成另一张图片<style> .test{display:block;width:100px;height:100px;background:url(xxx.jpg)} .test:hover{background:url(yyy.jpg)} </style> <a class="test" href="#"></a&gt;也可以这...

CSS鼠标移动到我的连接图片的时候更换另一张图片写了个例子: <a href="#"><img src="http://img.baidu.com/img/logo-zhidao.gif" border="0" onMouseOver="this.src='http://.google.cn/intl/zh-CN/images/logo_cn.gif'" onMouseOu...

易语言鼠标放图片框上改变图片移走后复原.版本 2 .子程序 __启动窗口_创建完毕 .局部变量 横向位置, 整数型 .局部变量 纵向位置, 整数型 横向位置 = 1 纵向位置 = 2 .子程序 _图片框1_鼠标位置被移动, 逻辑型 .参数...

宝贝详情页里面如何做鼠标滑过变换图片代码是什么不用CSS权限鼠标事件 (Mouse Events)在下列元素中无效:base、bdo、br、frame、frameset、head、html、iframe、meta、param、script、style 以及 title 元素。属性值描述onclick 脚本 当鼠...

鼠标经过图片放大代码那个是jquery的效果=。=就需要导入jquery包。。。。 如果你不需要jquery包,就要自己写js, 我帮你看看,我好想有类似的js,稍等 <script type="text/javascript"> function ChangeI...

delphi请教:当鼠标经过图片时如何将鼠标变为手掌很简单 在image组件的鼠标移动事件中,将鼠标显示类型改为手型 procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin Image1.Curs...

div文字这样环绕图片!css怎么定义方法很分多,可以把图片和文字分别放在div中然后浮动即可。 我写一个给你,稍等! <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style...

CSS中如何实现图片垂直居中在曾经的 淘宝UED 招聘 中有这样一道题目: “使用纯CSS实现未知尺寸的图片(但高宽都小于200px)在200px的正方形容器中水平和垂直居中。” 当然出题并不是随意,而是有其现实的原...

鼠标移到图片上改变图片亮度$("img").hover(function(){$(this).attr("src","1-1-1.png")},function(){})如果是九张都要有效果$("img").each(function () { $(this).hover(function () { var src = $(this).attr("s...

推荐阅读
图文推荐