Skip to content

Instantly share code, notes, and snippets.

@nleush
Created June 30, 2015 14:08
Show Gist options
  • Save nleush/00e9b4df2c344f4f1687 to your computer and use it in GitHub Desktop.
Save nleush/00e9b4df2c344f4f1687 to your computer and use it in GitHub Desktop.
Centering responsive 100% width block with max-width contraint.
<style>
.centering-fullwidth {
width: 100%;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.constraint-container {
width: 100%;
}
</style>
<!-- full width centering container -->
<div class="centering-fullwidth">
<!-- 500px width constraint -->
<div class="constraint-container" style="max-width: 500px;">
<!-- start responsive content: replace with your responsive embed code -->
<div style="width: 100%; background: black; height: 400px;"></div>
<!-- end responsive content -->
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment