Skip to content

Instantly share code, notes, and snippets.

@Matt-Jensen
Last active December 19, 2015 19:18
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 Matt-Jensen/6005168 to your computer and use it in GitHub Desktop.
Save Matt-Jensen/6005168 to your computer and use it in GitHub Desktop.
Quick css snippet for a 100% viewport width and height for full screen background images and the like. Keeps everything in the flow of the DOM as well.
/* Parent Element */
#background-container {
height: 100%;
min-height: 100%;
width: 100%;
position: relative;
background: black;
}
/* Child Element */
#background {
width: 100%;
height: 100%;
position: absolute;
bottom: 0;
background: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment