I would like to change the appearance of the content in the <main>
tag of my HTML page when an input box in the header nav is checked. This problem applies to a project I am working on but here is a simplified version showing the structure of my code:
nav input:checked+main {
background-color: red;
}
<header>
<nav>
<input type="checkbox">
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</nav>
</header>
<main>
Main page content
</main>
Ideally I would like to target the <footer>
that succeeds the <main>
tag as well. I have tried various selector combinations but the style of the main content does not change. Please note that ideally I do not want to change the structure of the page.