Skip to content

Instantly share code, notes, and snippets.

@cahnory
Created February 3, 2012 19:30
Show Gist options
  • Save cahnory/1731918 to your computer and use it in GitHub Desktop.
Save cahnory/1731918 to your computer and use it in GitHub Desktop.
Centrage horizontal et vertical — navigateurs modernes
/**
* Centrage horizontal et vertical — navigateurs modernes
*/
html, body {
height: 100%;
margin: 0;
width: 100%;
}
.layout {
display: table;
height: 100%;
overflow: hidden;
text-align: center;
width: 100%;
}
.layout-wrapper {
display: table-cell;
vertical-align: middle;
width: 100%;
}
.layout-content {
display: inline-block;
text-align: left; /* Retour à l'alignement classique, non nécessaire */
}
<div class="layout">
<div class="layout-wrapper">
<div class="layout-content">
Vous êtes<br />
centré !
</div>
</div>
</div>
{"view":"split","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment