執行個體詳解用CSS設定一個元素半透明

來源:互聯網
上載者:User
大家會使用CSS設定一個元素半透明嗎?本文主要介紹了用CSS設定一個元素半透明的相關資料,非常不錯,具有參考借鑒價值,需要的朋友參考下吧,希望能協助到大家。


.opacity{  filter:alpha(opacity=50);       /* IE */  -moz-opacity:0.5;              /* 老版Mozilla */  -khtml-opacity:0.5;              /* 老版Safari */  opacity: 0.5;           /* 支援opacity的瀏覽器*/}

用 來設定一個元素為半透明


.filter = "alpha(opacity=" + opacity + ")";    /* IE */ .MozOpacity = (opacity / 100);                 /* 老版Mozilla */ .KhtmlOpacity = (opacity / 100);               /* 老版Safari */ .opacity = (opacity / 100);                    /* 支援opacity的瀏覽器*/

在Windows平台上縮放圖片,可能出現映像失真現象,可用IE的專有命令:


img{-ms-interpolation-mode: bicubic;}

大家學會了嗎?趕緊動手嘗試一下吧。

相關文章

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.