css image 热区

热区 就是你指定图片的一个区域 点击那里可以跳转到指定页面

链接 就是点击图片的任意地方跳转到指定页面


图片热区说明:

代码如下:

<!DOCTYPE html >
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />  
<title>自定义热区</title>  
<style type="text/css"> 


body {text-align:center;} 


/* 设置link为子对象定位基点(子对象将相对父容器定位) */ 


#link {position:relative;width:524px;margin:0 auto;} 



/* 设置所有链接透明度 */ 


#link a {filter:alpha(opacity=50);-moz-opacity:0.5;opacity: 0.5;}  



/* 把所有链接设置为绝对定位,设置内补丁,设置边框,设置显示模式,设置文本缩进,设置链接修饰,设置背景图片 */ 


#link a {position:absolute;padding:10px;border-width:2px;display:block;text-indent:-9999px;text-decoration:none;background:url("no.gif");} 
'

/* 设置各链接区域位置与高宽 */ 


#link a.on1 {width:24px;height:18px;left:0;top:0;}  


#link a.on2 {width:235px;height:110px;left:265px;top:0;}  


#link a.on3 {width:240px;height:600px;left:0;top:130px;}  


#link a.on4 {width:235px;height:600px;left:265px;top:130px;} 


/* 设置所有链接鼠标经过状态 */ 


#link a:hover {border:dashed red 2px;display:block;color:#000;font-weight:bold;background-color:#fff;} 


/* 设置各链接当鼠标经过时状态 */ 


#link a.on1:hover {filter:alpha(opacity=100);-moz-opacity:1;opacity:1;background-color:transparent;} 


#link a.on2:hover {text-indent:0;filter:alpha(opacity=100);-moz-opacity:1;opacity:1;}  


#link a.on3:hover {border-color:#000;} 


#link a.on4:hover {background-image:url([img]22.JPG[/img]);}  



</style>  


</head>  


<body>  


<div id="link">  


   <a href="#" class="on1"> 玩号热区</a>  


   <a href="#" class="on2"> 图号热区</a>  


   <a href="#" class="on3"> 四锐号热区</a>  


   <a href="#" class="on4"> 佛号热区</a>  


</div>  


<div id="pr">  


    <img src="22.JPG" alt="用CSS自定义热区" />  


</div>  


</body>  


</html> 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值