i have the following code example
i am trying to affect all h1 content except the <strong> content
i tried using the child combinator and the :first-child selector and couldnt, thanks in advance
h1 {
background-color: aqua;
}
/* option 1 */
div h1:not( > strong) {
background-color: yellow;
}
/* option 2 */
div h1:not(:first-child) {
background-color: yellow;
}
<div>
<h1>
<strong>STRONG Line #1, Intended to stay the same aqua</strong><br> Line #2, Intended to be Yellow.
</h1>
</div>
<span>Line #3, not in the div at all.</span>
here is the testing console developer.mozilla
If you target the
strongelement within theh1directly, you can style it to be different than the rest of the content. See the below as an example: