Skip to content

Instantly share code, notes, and snippets.

@leechy
Created April 24, 2014 17:11
Show Gist options
  • Save leechy/11262139 to your computer and use it in GitHub Desktop.
Save leechy/11262139 to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html,
body {
height: 100%;
margin: 0;
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
}
.a {
height: 100%;
box-shadow: 0 0 2px green inset;
text-align: center;
font-size: 0px;
}
.a:after {
display: inline-block;
content: ' ';
height: 100%;
vertical-align: middle;
}
.b {
display: inline-block;
vertical-align: middle;
font-size: 18px;
border: 2px solid blue;
}
<!-- content to be placed inside <body>…</body> -->
<div class="a">
<div class="b">
Хочу этот див по центру по вертикали!
</div>
</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment