Skip to content

Instantly share code, notes, and snippets.

@sarvar
Created January 6, 2019 17:34
Show Gist options
  • Save sarvar/62df751e280b6e9319e49e90624255ba to your computer and use it in GitHub Desktop.
Save sarvar/62df751e280b6e9319e49e90624255ba to your computer and use it in GitHub Desktop.
Vertical and Horizontal align center
<div class="full-height">
<div class="vertical-center">
<div class="row justify-content-center">
<div class="col-md-4 col-sm-6 col-12">
<h1>Some Text</h1>
</div>
</div>
</div>
</div>
.full-height{
height: calc(100vh - 360px);
min-height: 100%;
display: table;
width: 100%;
}
.vertical-center{
display: table-cell;
text-align: center;
vertical-align: middle;
}
.row{
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.justify-content-center {
-webkit-box-pack: center!important;
-webkit-justify-content: center!important;
-ms-flex-pack: center!important;
justify-content: center!important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment