Created
September 22, 2016 09:00
-
-
Save tyaslab/5964e2df7b48bea8c9fc1d04df55eadd to your computer and use it in GitHub Desktop.
Center for Fixed Height
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
<div class="wrapper"> | |
<div class="v-center"> | |
<div class="inner"> | |
Centered Horizontally and Vertically Sayang opo kowe krungu jerite atiku mengharap kau kembali sayang nganti memutih rambutku ra bakal luntur tresnaku<br> | |
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=120%C3%9770&w=120&h=70"> | |
</div> | |
</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
.wrapper { | |
background-color: yellow; | |
height: 200px; | |
} | |
.v-center { | |
background-color: green; | |
text-align: center; | |
position: relative; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} | |
img { | |
vertical-align: middle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment