Created
May 15, 2023 08:47
-
-
Save andxbes/5a0bbaa75a182523c6d6c2d1f833413f to your computer and use it in GitHub Desktop.
True .alignfull
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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