本文主要为大家分享三种CSS截图的方法 ,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧,希望能帮助到大家。
CSS截图图片的几种方式
原图: 
DIV 使用background-position:Xpx Ypx (图片左上角坐标) 配合width和height
效果图: 
IMG 使用clip: rect(左上Y 右下X 右下Y 左上X) 配合width和margin-top
@@##@@
效果图:
![三种CSS截图的方法]()
立即学习“前端免费学习笔记(深入)”;
DIV+IMG 使用margin属性和overflow属性控制
@@##@@
效果图: 
完整版Html如下:
Untitled Page
原图
p
使用background-position:Xpx Ypx (图片左上角坐标) 配合width和height
background: url(img/bk_title_all.jpg); width: 550px;
width: 550px;
height: 113px;
background-repeat: no-repeat;
background-position: 0px -599px;
IMG
使用clip: rect(左上Y 右下X 右下Y 左上X) 配合width和margin-top
img src="img/bk_title_all.jpg"
clip: rect(599px 550px 712px 0px);
position: absolute;
width: 550px;
margin-top: -599px;
@@##@@
p+IMG
使用margin属性和overflow属性控制
p
width: 550px;
height: 113px;
overflow: hidden;
IMG
margin: -599px 0 0 0;
@@##@@











