-
-
Save w-perspective/b89e321547a0ed1673e783f841eb5e9d to your computer and use it in GitHub Desktop.
DIV Equal Height with position absolute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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