I have nested div tags, and the idea is that the outer one contains a background picture, and then the inner ones have text over them. I'd like to change the opacity on the background picture div so that it's more transparent and easier to see the text. My problem is that it's automatically applying that same opacity to child divs, which I do not want it to do.
Here is the code:
<style type="text/css">
.myBackgroundDivs {
background-image: url('homePageBackground.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: contain;
text-align: center;
opacity: 0.4;
}
.myTextDivs{
text-align: center;
opacity:1.0;
}
</style>
And then:
<div class="container">
<div class="jumbotron myBackgroundDivs" >
<div class="myTextDivs">
<h1>Some Text</h1>
<h3>Some more text</h3>
<br><br>
</div>
</div>
</div>
Now I looked into this, and I understand that for child elements, opacity actually multiplies itself by the parent element's opacity. With this logic, I tried using 2.5 so 2.5*.4 is 1.0, but I guess you can only go as high as 1.0 opacity.
Any suggestions?
If anyone wanted to explain to what extent/the rules of child divs inheriting attributes from parent divs that would be cool too