Created
May 12, 2012 04:54
-
-
Save iamstarkov/2664227 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* http://stackoverflow.com/questions/10561162/how-can-i-vertically-align-two-floated-divs | |
*/ | |
#parent { | |
position: relative; | |
/* decoration */ | |
width: 500px; | |
height: 200px; | |
background-color: #ddd; | |
} | |
.child { | |
position: absolute; | |
top: 50%; | |
height: 70px; | |
/* if text is one-line, line-height equal to height set text to the middle */ | |
line-height: 70px; | |
/* margin-top is negative 1/2 of height */ | |
margin-top: -35px; | |
/* decoration */ | |
width: 200px; | |
text-align: center; | |
background-color: #dfd; | |
} | |
.child_left { left: 0; } | |
.child_right { right: 0; } |
This file contains 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
<!-- content to be placed inside <body>…</body> --> | |
<div id='parent'> | |
<div class='child child_left'>Some text</div> | |
<div class='child child_right'>Details</div> | |
</div> |
This file contains 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
{"view":"separate","fontsize":"100","seethrough":"1","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment