Last active
August 29, 2015 13:56
-
-
Save panych/c3aed74635661d31b816 to your computer and use it in GitHub Desktop.
Justify-blocks sass mixin
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
// Mixin to layout blocks to justify parent width | |
// Works IE6+, Chrome, FF, Opera, Safari | |
// | |
// NOTE Don't forget to set font-size, line-height and text-align to child | |
// elements. | |
// NOTE that whitespace between list items is required. | |
// ISSUE: extra space at bottom. | |
// | |
// Usage example: | |
// HTML: | |
// <ul class="navigation"> | |
// <li>Item 1</li> | |
// <li>Item 2</li> | |
// <li>Item 3</li> | |
// </ul> | |
// | |
// SCSS: | |
// .navigation { | |
// @include justify-blocks; | |
// } | |
// | |
// .navigation > li { | |
// display: inline-block; | |
// font-size: 14px; | |
// line-height: 1.3; | |
// text-align: left; | |
// text-align-last: left; | |
// } | |
// | |
@mixin justify-blocks { | |
line-height: 0; | |
font-size: 0; | |
text-align: justify; | |
text-align-last: justify; | |
text-justify: newspaper; | |
*zoom: 1; | |
&:after { | |
content: ""; | |
display: inline-block; | |
width: 100%; | |
height: 0; | |
visibility: hidden; | |
overflow: hidden; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment