Skip to content

Instantly share code, notes, and snippets.

@w-perspective
Forked from agragregra/DIV Equal Height
Last active January 8, 2019 14:43
Show Gist options
  • Select an option

  • Save w-perspective/b89e321547a0ed1673e783f841eb5e9d to your computer and use it in GitHub Desktop.

Select an option

Save w-perspective/b89e321547a0ed1673e783f841eb5e9d to your computer and use it in GitHub Desktop.
DIV Equal Height with position absolute
<style>
.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;
}
</style>
<div class="square">
<span class="square_dummy"></span>
<span class="square_element">Content</span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment