日期:2014-05-17  浏览次数:20595 次

有关web显示图片的问题。在线求教。
1440的图片。直接img里面在小于1440的分辨率下,如何让图片从中间向两边扩展?

<div style="width:100%;overflow-x:hidden;"><!--控制左右滚动条  这里写什么 0 auto ; text-center 都不行的-->
<div class="b"><img src="img/x_06.jpg" /></div>
</div>

如果以上方法无法实现,小弟还有一个想法。那就是。
background:url(x_06.jpg) no-repeat center top; 这种展示出来是理想的效果,但是,背景图片如何局部加上超链? 需要用到coords 写坐标吗?可是,这坐标位置不容易写对啊。


请求大佬指点。。。。

------解决方案--------------------
既然是背景图片,那么在要加链接的地方写个DIV不就好了?
------解决方案--------------------
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gbk" />
<title></title>
<style>
.test {
width:100px; height:100px;
border:1px solid red;
background:url(http://avatar.profile.csdn.net/B/3/A/1_webyellow.jpg) 50% no-repeat;
}
</style>
</head>
<body>
<img src="http://avatar.profile.csdn.net/B/3/A/1_webyellow.jpg" alt="" />
<div class="test">
</div>
</body>
</html>



也可以使用clip
------解决方案--------------------
链接可以 把a定位在div上
设置absolute,left top 来调位置
------解决方案--------------------
用JS吧,这个已经超出了css的范畴了
------解决方案--------------------
http://www.w3school.com.cn/js/js_image_maps.asp看看这个吧,图片局部链接。
------解决方案--------------------
http://www.w3school.com.cn/js/js_image_maps.asp