Created
January 15, 2015 09:27
-
-
Save malinky/0dd23c817d2b6129cc13 to your computer and use it in GitHub Desktop.
Position absolute, fixed height, centered header image
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
/* | |
* 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