示例图片:width:197px   height:87px

              CSS剪切图片

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    
<title>CSS剪切图片</title>
    
    
<style type="text/css"> 
        #img1 
{ 
              position
:absolute; 
              clip
:rect(30px 80px 60px 20px); 
        
} 
    
</style> 
    
</head>

<body>

示例图片:Width:197px,Height:87px;
<br />
<img src="DemoImage.jpg" alt="demo img" />
<hr />
<pre>
<b>使用clip剪切"谷歌"两个字 </b>
        语法:
            clip:auto|rect( number number number number )
            clip:rect(30px 80px 60px 20px);
            clip:rect( 上   右   下   左 );
            
        说明:此属性定义了绝对(absolute)定位对象可视区域的尺寸。必须将 position 属性的值设为 absolute ,此属性方可使用。
        
<img id="img1" src="DemoImage.jpg" alt="demo img" />
<pre/>
</body>
</html>

相关文章:

  • 2021-05-23
  • 2021-10-08
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-11-28
  • 2021-07-16
猜你喜欢
  • 2021-12-10
  • 2021-09-22
  • 2022-12-23
  • 2021-06-30
  • 2021-11-29
  • 2021-07-06
  • 2022-12-23
相关资源
相似解决方案