Is there a way to determine the max-width of an element in CSS based on the viewport width and the position of the element? I have a div that holds a table with variable column widths, so the size can change depending on the data. I want to set a maximum width for the container with a horizontal scroll using 100vw
, but I also need to account for a sidebar that users can show or hide. I'm considering calculating the max-width as
100vw - [left position of the container div]
, but I'm open to other suggestions for achieving this using only CSS.