Skip to content

Instantly share code, notes, and snippets.

@YauhenKavalchuk
Last active September 1, 2015 18:46
Show Gist options
  • Save YauhenKavalchuk/8d0f9b41d95e49738b28 to your computer and use it in GitHub Desktop.
Save YauhenKavalchuk/8d0f9b41d95e49738b28 to your computer and use it in GitHub Desktop.
HTML:
<div class="square">
<span class="square_dummy"></span>
<span class="square_element">Content</span>
</div>
CSS:
.square {
display: inline-block;
position: relative;
width: 55%;
}
.square_dummy {
margin-top: 100%;
display: block;
}
.square_element {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment