Created
May 12, 2012 11:15
-
-
Save iamstarkov/2665905 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; | |
} | |
#left-box { left: 0; } | |
#right-box { 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 id='left-box' class='child'>Some text</div> | |
<div id='right-box' class='child'>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