So I have a <header> tag with a <h1> tag inside it. The <header> tag has a CSS background image that I want to slowly fade in using either CSS or jQuery.
<header>
<h1>Title</h1>
</header>
Is this possible without fading in the entire <header> tag (which will also fade in the <h1> tag? I don’t want to modify the HTML in any way.
Children elements inherit the opacity of their parents.
If your background is a colour, you can animate the
background-colorproperty instead.If it’s not a colour, you can move the children outside of the animating element but then position with CSS so they look like children (or whatever matches your design).