2016-02-29 74 views
0

我想在html中缩放图像的一部分。 为了在html中显示图像的一部分,我在第一条评论中写了一段代码。 我想放大显示的这部分。我该怎么做。如何在html中缩放图像的一部分?

<!DOCTYOE html> 
<html> 

<head> 
    <style> 
     .container { 
      position: relative; 
     } 

     #clip { 
      position: absolute; 
      clip: rect(0, 120, 80px, 0); 
      /* clip: shape(top, right, bottom, left); NB 'rect' is the only available option */ 
     } 

     </div> 
    </style> 
</head> 
<div class="container"> <img src="images10.png" /> </div> 
<div class="container"> <img id="clip" src="images10.png" /> </body> 

</html> 
+3

这里有http://stackoverflow.com/questions/15757036/creating长时间的讨论-a变焦效果的上一个图像上悬停-使用-CSS – Manwal

回答

0

你可以试试下面的代码会放大指定部分:

#clip { zoom: 150%; } 

FYI:More info here