I'm struggling to solve a design challenge involving three columns: a navbar (dark gray), main content (dark red), and sidebar (dark green). The navbar should be expandable and collapsible, while the sidebar should slide in and out. My goal is to make this layout responsive by adjusting the size of the main content area when either or both the navbar and sidebar are expanded. My current approach involves using calc(100% - navbar width - sidebar width) to determine the width of the main content, but this solution feels verbose when checking if the sidebar, navbar, or both are expanded.
Here's an illustration showing how the main content shrinks:
https://i.sstatic.net/MSIHN.png
I've considered using flexbox for this layout, but I haven't been able to figure it out yet.
Here's an example markup:
<nav> </nav>
<main> </main>
<aside> </aside>
Note: The nav and aside elements need to be 100% height of the page and fixed in place.