Last active
August 24, 2017 19:31
-
-
Save Farmatique/9be1eb03e7faa3a5828af578191de115 to your computer and use it in GitHub Desktop.
Justify LI inside UL
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
<div class="container"> | |
<ul id="justified-menu"> | |
<li class="inline-block"> | |
<span>This old man</span> | |
</li> | |
<li class="inline-block"> | |
<span>he played five</span> | |
</li> | |
<li class="inline-block"> | |
<span>he played nicknack on his hive</span> | |
</li> | |
</ul> | |
</div> | |
#justified-menu { | |
position: relative; | |
text-align: justify; | |
font-size: 0; // to remove bottom padding caused by :after-element | |
} | |
#justified-menu:after { | |
position: relative; | |
display: inline-block; | |
width: 100%; | |
height: 0; | |
line-height: 0; | |
content: ''; | |
} | |
.inline-block { | |
display: inline-block; | |
float: none; | |
font-size: 14px // set font-size again | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment