图片定位 css

原文发布时间为:2009-07-14 —— 来源于本人的百度文章 [由搬家工具导入]

原图片:http://cache.soso.com/wenwen/i/w_icon.gif

从这图片定位几张图片出来:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片定位</title>
<style type="text/css">
.dingwei{
background:url(http://cache.soso.com/wenwen/i/w_icon.gif) no-repeat;
}

.childd{
background-position: 0px -350px;
16px;
height:16px;
}
.childd2{
background-position:0 -251px;
16px;
height:16px;
}
.childd3{
background-position:-88px -320px;
16px;
height:16px;
}
</style>
</head>
<body>
<div class="dingwei childd" id="hehe"></div>
<div class="dingwei childd2" id="hehe2"></div>
<div class="dingwei childd3" id="hehe3"></div>
</body>
</html>

===================================

-50 -50 是指图片沿着容器div,要想左移动50,向上移动50,想要获取的那个图片才能在div的左上角那个位置开始。

可以用工具FastStone Capture的 矩形框截图工具定位。http://1.fjdx1.crsky.com/200907/FSCapture_v6.5H.rar

原文地址:https://www.cnblogs.com/handboy/p/7153271.html