Change background image opacity

后端 未结 8 1436
-上瘾入骨i
-上瘾入骨i 2020-12-03 09:56

I have a div element with text blocks and a parent div in which I have set a background image. Now I want to reduce the opacity of the background image. Please suggest how I

相关标签:
8条回答
  • 2020-12-03 10:25

    Responding to an earlier comment, you can change the background by variable in the "container" example if the CSS is in your php page and not in the css style sheet.

    $bgimage = '[some image url];
    background-image: url('<?php echo $bgimage; ?>');
    
    0 讨论(0)
  • 2020-12-03 10:29

    You can create several divs and do that:

    <div style="width:100px; height:100px;">
       <div style="position:relative; top:0px; left:0px; width:100px; height:100px; opacity:0.3;"><img src="urltoimage" alt=" " /></div>
       <div style="position:relative; top:0px; left:0px; width:100px; height:100px;"> DIV with no opacity </div>
    </div>
    

    I did that couple times... Simple, yet effective...

    0 讨论(0)
提交回复
热议问题