Skip to content

Instantly share code, notes, and snippets.

@dennisfrank
Created January 25, 2013 13:46
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 dennisfrank/4634583 to your computer and use it in GitHub Desktop.
Save dennisfrank/4634583 to your computer and use it in GitHub Desktop.
Define aspect ratio for elements in CSS
/**
* Define aspect ratio for elements in CSS
*/
div {
height: 0;
width: 33%;
padding-bottom: 33%;
float: left;
outline: 1px solid;
overflow: hidden;
}
marquee {
font-size: 140px;
}
<div>
<h1>
CAN I HAZ ASPECT RATIO BOXES?
</h1>
</div>
<div>
<img src="http://placekitten.com/g/500/500">
</div>
<div>
<marquee>YES!</marquee>
</div>
// alert('Hello world!');
{"view":"separate","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