Last active
December 11, 2015 02:19
-
-
Save bohman/4530016 to your computer and use it in GitHub Desktop.
Stretch: simple way to stretch boxes to edge of screen without additional elements. Here's a good article with description: http://css-tricks.com/full-browser-width-bars/
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
.center { | |
width: 980px; | |
margin-left: auto; | |
margin-right: auto; | |
} | |
html, body { | |
overflow-x: hidden; /* Prevents horizontal scroll */ | |
} | |
.stretch { | |
position: relative; | |
} | |
.stretch:before, | |
.stretch:after { | |
content: ' '; | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
width: 10000px; | |
} | |
.stretch:before { | |
right: 100%; | |
} | |
.stretch:after { | |
left: 100%; | |
} | |
.stuff1:before, | |
.stuff1:after, | |
.stuff1 { | |
background-color: #ffcb00; | |
} | |
.stuff2:before, | |
.stuff2:after, | |
.stuff2 { | |
background-color: #00cb00; | |
} |
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
<div class="center stretch stuff1"> | |
whatever content you want | |
</div> | |
<div class="center stretch stuff2"> | |
whatever content you want | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment