Last active
November 30, 2018 15:14
-
-
Save atikju/c822d3a9efe130d9cc82364cadfe13e0 to your computer and use it in GitHub Desktop.
CSS - Force Full Width
This file contains hidden or 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
| /* | |
| Here 300px is the parent width | |
| */ | |
| .autowide.devst { | |
| width: 100vw; | |
| background: #f1f2f2; | |
| padding-top: 26px; | |
| margin-left: calc(-100vw / 2 + 300px / 2); | |
| margin-right: calc(-100vw / 2 + 300px / 2); | |
| } | |
| /* | |
| For Percentage Width | |
| */ | |
| .main { | |
| width: 60%; | |
| margin: 0 auto; | |
| /* creates 20% margins on either side */ | |
| } | |
| .full-width { | |
| /* 1/3 of 60% = the 20% margin on either side */ | |
| margin-left: -33.33%; | |
| margin-right: -33.33%; | |
| } | |
| /* | |
| Credit CSS TRICKS - https://css-tricks.com/full-width-containers-limited-width-parents/ | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment