Background image transparency with CSS3?

后端 未结 8 2254
生来不讨喜
生来不讨喜 2020-12-29 06:41

Is there a way to add transparency to a background-image using CSS3?

8条回答
  •  再見小時候
    2020-12-29 07:30

    yes, IE9, Firefox, Chrome, Opera, and Safari use the property opacity for transparency. The opacity property can take a value from 0.0 - 1.0. A lower value makes the element more transparent.

    IE8 and earlier use filter:alpha(opacity=x). The x can take a value from 0 - 100. A lower value makes the element more transparent.

    img
    {
        opacity: 0.5; /*(Range = 0.0 to 1.0)*/
        filter: alpha(opacity = 50); /* (Range = 0% to 100%) For IE8 & ealier */
    }
    

    Also we can give OPACITY to any

    tag and make transparent boxes.

    Here is the *

    FULL EXAMPLE


    
    
    
    
    
    
    
    

    This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box. This is some text that is placed in the transparent box.

提交回复
热议问题