I'm building out a UI that requires a fixed position/sticky element at the bottom of the viewport with a width constrained by a main content area. The main content area is optionally flanked by (sibling) left and/or right sidebars with fixed widths, so I'm using Flexbox to build the three column structure with flex-grow: 1
on the main content.
I've learned from @Marc Audet's accepted answer at How can I make a fixed positioned div inherit width of parent? that setting width: inherit
on the fixed element is typically how to solve this problem, but it only seems to work when there's a specified width on its parent, which doesn't help me considering I need the main content area to fill the remaining width of the page.
Does anyone have any ideas for getting around this? Check out my Fiddle for the code/example. Any help would be appreciated!
width: calc(100vw - 150px - 250px);
– Bromleyleft:150px
andright:250px
instead. – Coxcombrywidth:inherit
doesn't work is that the default value forwidth
isauto
, which is being inherited just fine, it's just not helping you in this case. I know possible solutions to your issue but they're highly complex involving multiple sibling selectors... – Coxcombry