Skip to content

Instantly share code, notes, and snippets.

@andxbes
Created May 15, 2023 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andxbes/5a0bbaa75a182523c6d6c2d1f833413f to your computer and use it in GitHub Desktop.
Save andxbes/5a0bbaa75a182523c6d6c2d1f833413f to your computer and use it in GitHub Desktop.
True .alignfull
main .alignfull {
margin: 2rem calc(50% - (50vw - var(--scrollbar-width) / 2)) !important;
max-width: calc(100vw - var(--scrollbar-width)) !important;
width: calc(100vw - var(--scrollbar-width));
}
function _calculateScrollbarWidth() {
document.documentElement.style.setProperty('--scrollbar-width', (window.innerWidth - document.documentElement.clientWidth) + "px");
}
window.addEventListener('resize', _calculateScrollbarWidth, false);
document.addEventListener('DOMContentLoaded', _calculateScrollbarWidth, false);
window.addEventListener('load', _calculateScrollbarWidth);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment