Skip to content

Instantly share code, notes, and snippets.

@tbassetto
Forked from cahnory/dabblet.css
Created February 6, 2012 13:46
Show Gist options
  • Save tbassetto/1752176 to your computer and use it in GitHub Desktop.
Save tbassetto/1752176 to your computer and use it in GitHub Desktop.
Centrage horizontal et vertical — universel
/**
* Centrage horizontal et vertical — universel
*/
html, body {
height: 100%;
margin: 0;
width: 100%;
}
.layout {
display: table;
height: 100%;
overflow: hidden;
text-align: center;
width: 100%;
*position: relative;
}
.layout-wrapper {
display: table-cell;
vertical-align: middle;
width: 100%;
*left: 0;
*position: absolute;
*top: 50%;
}
.layout-content {
display: -moz-inline-stack;
display: inline-block;
text-align: left; /* Retour à l'alignement classique, non nécessaire */
*display: inline;
*left: 0;
*position: relative;
*zoom: 1;
*top: -50%;
}
<div class="layout">
<div class="layout-wrapper">
<div class="layout-content">
<div contenteditable="true">
Vous êtes<br />
centré !
</div>
</div>
</div>
</div>
{"view":"split","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment