Click here to Skip to main content
14,977,910 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using something similar to the following code:
HTML
<div style="opacity:0.6; background-image:url(...);">
    <div style="opacity:1.0;">
        Text
    </div>
</div>

I expected this to make the background have an opacity of 0.4 and the text have 100% opacity. Instead, they both have an opacity of 0.4.

What I have tried:

tried this code but not able to achieve the result
Posted
Updated 21-Jun-21 3:34am
v2
Comments
Afzaal Ahmad Zeeshan 19-Jun-21 7:03am
   
There is no code in your question. Maybe see this SO thread for a similar problem.

This is virtually identical to the solved question on StackOverflow posted back in 2012 by John Wheal:
html - CSS Background Opacity - Stack Overflow[^]

Why are you copying questions from StackOverflow and reposting them here?
   
sorry maybe i clicked someting else
here is the code
<div style="opacity:0.6; background-image:url(...);">
<div style="opacity:1.0;">
Text
</div>
</div>
   
Comments
Richard Deeming 21-Jun-21 9:27am
   
If you want to update your question, click the green "Improve question" link and edit your question.

Do not post your update as a "solution" to your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900