Skip to content

Instantly share code, notes, and snippets.

@xem
Created April 5, 2013 12:58
Show Gist options
  • Save xem/5319091 to your computer and use it in GitHub Desktop.
Save xem/5319091 to your computer and use it in GitHub Desktop.
vertical margins and paddings depend on the parent's width. Are there other CSS properties that do the same?
/* vertical margins and paddings depend on the parent's width. Are there other CSS properties that do the same? */
div.out {
width: 800px;
height: 400px;
overflow: hidden;
background: #abc;
}
div.in {
width: 10%; /* = 80px */
height: 10%; /* = 20px */
margin: 10%; /* = 80px 80px 80px 80px */
padding: 10%; /* = 80px 80px 80px 80px */
background: #dcb;
}
<div class="out">
<div class="in">
Wat.
</div>
</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment