Skip to content

Instantly share code, notes, and snippets.

@malinky
Created January 15, 2015 09:27
Show Gist options
  • Save malinky/0dd23c817d2b6129cc13 to your computer and use it in GitHub Desktop.
Save malinky/0dd23c817d2b6129cc13 to your computer and use it in GitHub Desktop.
Position absolute, fixed height, centered header image
/*
* 1. Position if underneath a fixed navigation.
* 2. Set to image height.
*/
.header-image {
position: absolute;
overflow: hidden;
top: px /* 1 */
left: 0;
width: 100%;
height: px; /* 2 */
}
/*
* 1. Set to half image width (-ve).
*/
.header-image img {
position: absolute;
top: 0;
left: 50%;
margin-left: -px /* 1 */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment