Created
February 28, 2015 04:15
-
-
Save exelxior/5ce8dd21a46792b01521 to your computer and use it in GitHub Desktop.
Centering texts in a span in an image
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
| /** table-cell/vertical-align: middle **/ | |
| .parent { | |
| width: 100%; | |
| height: 100%; | |
| display: table; | |
| text-align: center; | |
| } | |
| .parent > .child { | |
| display: table-cell; | |
| vertical-align: middle; | |
| } | |
| /** line-height method: not suggested **/ | |
| /** transform translateX/translateY **/ | |
| /** Flexbox method **/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment