newcoder1010 Posted December 12, 2019 Share Posted December 12, 2019 Hello, HTML: <section id="block-situations"> <h2 class="block-title">Need to Sell Your House</h2> <div class="field field--name-body"> <div class="padd"> <ul class="eclipse-list"><li>Single family house</li> <li>Mult-units</li> <li>Town homes</li> </ul> </div> </div> </section> CSS: #block-situations { background-image: url(home-for-cash.png); background-repeat: no-repeat; background-size: cover; opacity: .5; } I like to apply opacity to #block-situations only. It works. But the problem is that eclipse.list class contents grayed out. That means once I have the opacity, .eclipse-list contents are not clear. How to apply opacity to parent class without affecting the eclipse-list class contents? Thanks! Link to comment Share on other sites More sharing options...
dsonesuk Posted December 12, 2019 Share Posted December 12, 2019 When using opacity it affects ALL child elements. Therefore you need to apply to a sibling of those child elements that will fill the whole parent using positioning like absolute, and use z-index to force it behind other sibling elements. Link to comment Share on other sites More sharing options...
newcoder1010 Posted December 13, 2019 Author Share Posted December 13, 2019 Thanks for your reply but it is confusing. If you could help me with some coding, it will be great. Link to comment Share on other sites More sharing options...
dsonesuk Posted December 13, 2019 Share Posted December 13, 2019 https://www.w3schools.com/code/tryit.asp?filename=G0V6RXVDG3PU Link to comment Share on other sites More sharing options...
newcoder1010 Posted December 13, 2019 Author Share Posted December 13, 2019 Thank you! I will play with that tonight. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now