Created
February 18, 2014 03:24
-
-
Save oksushi/9064144 to your computer and use it in GitHub Desktop.
Using table display to vertically centre a list of blocks
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
/** | |
* Using table display to vertically centre a list of blocks | |
*/ | |
ul { | |
list-style: none; | |
margin: 0; | |
padding: 0; | |
text-align: justify; | |
} | |
li { | |
text-align: center; | |
display: inline-table; | |
width: 200px; | |
background: #eee; | |
vertical-align: top; | |
height: 100px; | |
} | |
a { | |
display: table-cell; | |
vertical-align: middle; | |
transition: .5s background; | |
} | |
a:hover { | |
background: hotpink; | |
} |
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> --> | |
<ul> | |
<li><a href="/">Text</a></li> | |
<li><a href="/">Longer Text onto two lines, Longer Text onto two lines</a></li> | |
<li><a href="/">Text</a></li> | |
<li><a href="/">Longer Text onto two lines, Longer Text onto two lines</a></li> | |
</ul> |
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
// alert('Hello world!'); |
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","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment