CSS剪下圖片

來源:互聯網
上載者:User

 

樣本圖片:width:197px   height:87px

             

 

<!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剪下"Google"兩個字 </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>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.