Skip to content

Instantly share code, notes, and snippets.

@tamueka
Created June 6, 2019 11:47
Show Gist options
  • Save tamueka/9079cf089931ea733ffb1cdc57e98928 to your computer and use it in GitHub Desktop.
Save tamueka/9079cf089931ea733ffb1cdc57e98928 to your computer and use it in GitHub Desktop.
flexbox center image
<!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>
.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