Created
October 7, 2019 06:44
-
-
Save CarmenScholte/44795428e31e062855148db683246540 to your computer and use it in GitHub Desktop.
fixed-ratio-centered-cover-image
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
<!doctype html> | |
<html> | |
<head> | |
<style> | |
body { | |
margin: 0; | |
} | |
.container { | |
width: 100vw; | |
height: 100vh; | |
} | |
.background { | |
min-height: 100%; | |
min-width: 100%; | |
width: 1%; | |
height: 1%; | |
object-fit: cover; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<img class="background" src="https://images.unsplash.com/photo-1529264978834-666a0e99f884?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80"> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment