I've made the decision to incorporate a sidebar on the left side of all pages across my website. This sidebar must have the ability to be either hidden or shown, without overlapping the existing content on the page.
However, I'm encountering an issue where the content overflows from the container if a sidebar is present. I need the content to adjust based on the width of its container, not just the width of the browser window.
Creating a container for the content and setting overflow-y
to auto
isn't ideal since it would require this setup for every single page on the website...
So far, I've attempted adjusting the left margin on the body and using a div with position: fixed
as the sidebar.
If anyone has suggestions on how to ensure that the content adjusts according to the width of its container rather than the browser width, please share your insights!