Skip to content

Instantly share code, notes, and snippets.

@couto
Created November 30, 2012 10:38
Show Gist options
  • Save couto/4175053 to your computer and use it in GitHub Desktop.
Save couto/4175053 to your computer and use it in GitHub Desktop.
/**
* http://www.w3.org/TR/CSS2/visuren.html#relative-positioning
*
*/
.outer {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: gold;
}
/**
* I was expecting that this box offsetted to 50px from top
* instead, it offsetted to half of the parent's height.
* in webkit browsers, it doesn't offset at all.
*/
.inner {
width: 100px;
height: 100px;
position: relative;
top: 50%;
background: lightgrey;
}
<div class="outer">
<div class="inner"></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