Question about the opacity property in CSS. I have a header with a title, and I have an opacity of .3 applied to it (as well as a transition, but that's not what the question is about). Here is a gif:
Now, I like the effect the header has, as you can see the image behind it obviously, but I would like title itself to appear white, at opacity 1. Because of the opacity applied to its parent div, the header, it appears faded like the rest of the div. Is there a way to do this? in other words, is there a way to "override" the opacity of a parent element?
html,
body {
margin: 0px;
padding: 0px;
height: 100vh;
}
#header {
position: absolute;
width: 100vw;
height: 0vh;
background-color: black;
opacity: 0;
z-index: 6;
transition: height 1s ease, opacity 1s ease;
}
#hoverable {
position: absolute;
height: 10vh;
width: 100%;
z-index: 7;
}
#hoverable:hover #header {
opacity: .3;
height: 10vh;
}
#title {
margin-left: 10vw;
line-height: 10vh;
float: left;
}
<div id="hoverable">
<div id="header">
<div id="title">
<h1>TITLE</h1>
</div>
</div>
</div>