Skip to content

Instantly share code, notes, and snippets.

@peterhry
Created September 29, 2014 17:27
Show Gist options
  • Save peterhry/a5658b08a768664e0f24 to your computer and use it in GitHub Desktop.
Save peterhry/a5658b08a768664e0f24 to your computer and use it in GitHub Desktop.
CSS to force square aspect ratio
.l-square {
padding-top: 100%;
position: relative;
}
.l-square > div {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment