| 1 |
// Horizontal list layout module. |
| 2 |
// |
| 3 |
// Easy mode using simple descendant li selectors: |
| 4 |
// |
| 5 |
// ul.nav |
| 6 |
// +horizontal-list |
| 7 |
// |
| 8 |
// Advanced mode: |
| 9 |
// If you need to target the list items using a different selector then use |
| 10 |
// +horizontal-list-container on your ul/ol and +horizontal-list-item on your li. |
| 11 |
// This may help when working on layouts involving nested lists. For example: |
| 12 |
// |
| 13 |
// ul.nav |
| 14 |
// +horizontal-list-container |
| 15 |
// > li |
| 16 |
// +horizontal-list-item |
| 17 |
|
| 18 |
@import "bullets"; |
| 19 |
@import "../../utilities/general/clearfix"; |
| 20 |
@import "../../utilities/general/reset"; |
| 21 |
@import "../../utilities/general/float"; |
| 22 |
|
| 23 |
// Can be mixed into any selector that target a ul or ol that is meant |
| 24 |
// to have a horizontal layout. Used to implement +horizontal-list. |
| 25 |
@mixin horizontal-list-container { |
| 26 |
@include reset-box-model; |
| 27 |
@include clearfix; } |
| 28 |
|
| 29 |
// Can be mixed into any li selector that is meant to participate in a horizontal layout. |
| 30 |
// Used to implement +horizontal-list. |
| 31 |
// |
| 32 |
// :last-child is not fully supported |
| 33 |
// see http://www.quirksmode.org/css/contents.html#t29 for the support matrix |
| 34 |
// |
| 35 |
// IE8 ignores rules that are included on the same line as :last-child |
| 36 |
// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details |
| 37 |
// |
| 38 |
// Setting `$padding` to `false` disables the padding between list elements |
| 39 |
@mixin horizontal-list-item($padding: 4px, $direction: left) { |
| 40 |
@include no-bullet; |
| 41 |
white-space: nowrap; |
| 42 |
@include float($direction); |
| 43 |
@if $padding { |
| 44 |
padding: { |
| 45 |
left: $padding; |
| 46 |
right: $padding; |
| 47 |
} |
| 48 |
&:first-child, &.first { padding-#{$direction}: 0; } |
| 49 |
&:last-child { padding-#{opposite-position($direction)}: 0; } |
| 50 |
&.last { padding-#{opposite-position($direction)}: 0; } |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
// A list(ol,ul) that is layed out such that the elements are floated left and won't wrap. |
| 55 |
// This is not an inline list. |
| 56 |
// |
| 57 |
// Setting `$padding` to `false` disables the padding between list elements |
| 58 |
@mixin horizontal-list($padding: 4px, $direction: left) { |
| 59 |
@include horizontal-list-container; |
| 60 |
li { |
| 61 |
@include horizontal-list-item($padding, $direction); } } |