Created
June 6, 2019 11:47
-
-
Save tamueka/9079cf089931ea733ffb1cdc57e98928 to your computer and use it in GitHub Desktop.
flexbox center 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<div class="flexContainer flexCenter itemCenter fullHeight centerImage"> | |
<!-- <div class="flexContainer flexCenter itemCenter fullHeight"> --> | |
<a href="indexhtml" class="homeButton">Return</a> | |
<!-- </div> --> | |
<div> | |
</body> | |
</html> |
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
.flexContainer{ | |
display: flex; | |
} | |
.flexCenter { | |
justify-content: center; | |
} | |
.fullHeight { | |
height: 100vh; | |
} | |
.itemCenter { | |
align-items: center; | |
} | |
.centerImage { | |
background: url('https://github.com/ratracegrad/made-with-flexbox/blob/master/images/ocean.jpg?raw=true'); center; | |
background-size: cover; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment