天天看点

html截取显示部分的img图片

html截取显示部分的img图片

     web开发中,由于图片过大,显示区域有限,

经常需要显示图片的部分区域。

     解决方法:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank" rel="external nofollow" >http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"></p> <p><html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank" rel="external nofollow" >http://www.w3.org/1999/xhtml</a>" xml: >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></p> <p> <title>untitled</title></p> <p> <style type="text/css" media="screen">
div.crop {
height: 300px;
width: 350px;
overflow: hidden;
}
div.crop img {
margin: -200px -200px 0 0;
}
</style></p> <p></head></p> <p><body></p> <p><div class="crop">
<img src="001.jpg" class="crop" alt="Paper Sculpture Large">
</div></p> <p></body>
</html>