Skip to content

Instantly share code, notes, and snippets.

@xem
Created April 5, 2013 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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