Set opacity of background image without affecting child elements

前端 未结 15 2178
闹比i
闹比i 2020-11-22 01:39

Is it possible to set the opacity of a background image without affecting the opacity of child elements?

Example

All links in the footer need a custom bull

15条回答
  •  盖世英雄少女心
    2020-11-22 02:28

    If you are using the image as a bullet, you might consider the :before pseudo element.

    #footer ul li {
    }
    
    #footer ul li:before {
        content: url(/images/arrow.png);
        filter:alpha(opacity=50);
        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0.5);
        opacity:.50;
    }
    

提交回复
热议问题