css3的一些相容問題

來源:互聯網
上載者:User

標籤:

讓div 透明,相容IE FF

.box{filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5; opacity: 0.5;}
       /*透明度相容*/.box {        filter:alpha(opacity=50);        -moz-opacity:0.5;        -khtml-opacity: 0.5;        opacity: 0.5;  }   

  

相容性好的CSS3網頁漸層色背景特效代碼,適用於IE/Firefox、Opera等眾多瀏覽器,學會以使用CSS編寫網頁背景,可以大大減少網頁的資源佔用率,提升瀏覽體驗,好處多多。

  /*漸層的相容*/.gradient{    width:300px;    height:150px;    filter:alpha(opacity=100 finishopacity=50 style=1 startx=0,starty=0,finishx=0,finishy=150) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=0);    -ms-filter:alpha(opacity=100 finishopacity=50 style=1 startx=0,starty=0,finishx=0,finishy=150) progid:DXImageTransform.Microsoft.gradient(startcolorstr=red,endcolorstr=blue,gradientType=0);/*IE8*/    background:red; /* 一些不支援背景漸層的瀏覽器 */      background:-moz-linear-gradient(top, red, rgba(0, 0, 255, 0.5));      background:-webkit-gradient(linear, 0 0, 0 bottom, from(#ff0000), to(rgba(0, 0, 255, 0.5)));      background:-o-linear-gradient(top, red, rgba(0, 0, 255, 0.5)); }<div class="gradient"></div>

  

/*opacity=100 漸層開始的透明度,0代表完全透明,100代表完全不透明。
finishopacity=50 指定結束時的透明度,範圍也是0 到 100。
style用來指定透明地區的形狀特徵:
0 代表統一形狀
1 代表線形
2 代表放射狀
3 代表矩形。
startx 漸層透明效果開始處的 X座標。
starty 漸層透明效果開始處的 Y座標。
finishx 漸層透明效果結束處的 X座標。
finishy 漸層透明效果結束處的 Y座標。*/

 

因為IE6/7/8,對css3支援度的因素,以上只是自己平時做的一些方法,不對之處請各位多多包含,大家可以相互多多交流。

 

css3的一些相容問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.