-
-
Save pgherveou/2971898 to your computer and use it in GitHub Desktop.
Vertical centering with Flexbox + margin fallback
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
/** | |
* Vertical centering with Flexbox + margin fallback | |
* Lea Verou & David Storey | |
*/ | |
div { | |
width: 56px; /* needed for FF */ | |
height: 56px; | |
font-size: 30px; | |
border: 1px solid black; | |
/* Flexbox hawtness */ | |
display: box; display: flexbox; | |
box-align: center; flex-align: center; | |
box-pack: center; flex-pack: center; | |
background-image: linear-gradient(top, rgba(20, 20, 20, 0.5) 0%, rgba(20, 20, 20, 0.5) 50%, rgba(90, 90, 90, 0.5) 50%, rgba(90, 90, 90, 0.5) 100%); | |
} | |
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>×</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":"split-vertical","fontsize":"50","seethrough":"","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment