Skip to content

Instantly share code, notes, and snippets.

@Farmatique
Last active August 24, 2017 19:31
Show Gist options
  • Save Farmatique/9be1eb03e7faa3a5828af578191de115 to your computer and use it in GitHub Desktop.
Save Farmatique/9be1eb03e7faa3a5828af578191de115 to your computer and use it in GitHub Desktop.
Justify LI inside UL
<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