css父級div設定了透明度,子級也出現透明度的解決方案

來源:互聯網
上載者:User

由於父級div使用了opacity設定透明度,使子級div也繼承了透明度

我的解決方案是使用rgba,background-color:rgba(245,224,199,0.7),0.7是透明度,由於rgba是css3的屬性,所以必須是支援css3的瀏覽器才能支援rgba

文法:

R:紅色值。正整數 | 百分數

G:綠色值。正整數 | 百分數

B:藍色值。正整數| 百分數

A:透明度。取值0~1之間

取值:

<length> :Hue(色調)。 0(或360)表示紅色,120表示綠色,240表示藍色,當然可取其他數值來確定其它顏色;

<percentage> :Saturation(飽和度)。 取值為0%到100%之間的值;

<percentage> :Lightness(亮度)。 取值為0%到100%之間的值;

<opacity> :alpha(透明度)。 取值在0到1之間;

相關文章

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.