I have a <div>
with a background image and I'd like the background image to have a filter applied. But I'd also like the div to contain a <p>
tag which overlays the image -- and I DONT want the <p>
to have that same filter.
How do I clear the filter set by the <div>
in the <p>
?
What I've got so far:
<div className="artistDetailImage" style={{backgroundImage: url(${this.props.artistImage})`}}>
<p className="artistDetailText">{name}</p>
</div>
.artistDetailImage {
background-size: cover;
background-position: top;
width: 100%;
height: 300px;
filter: contrast(60%);
}
.artistDetailText {
width: 100%;
font-size: 20px;
text-align: left;
padding-left: 5px;
position: relative;
top: 240px;
filter: none; //Have also tried contrast(100%), brightness(1), etc.
color: white;
}
This answer seems to work, but I was hoping there was a better way to do it. https://stackoverflow.com/a/32677739/3010955