Dotclear

source: themes/berlin/scss/libs/_scut.scss @ 3427:75253b0af38a

Revision 3427:75253b0af38a, 29.2 KB checked in by franck <carnet.franck.paul@…>, 9 years ago (diff)

Cope with l10n for Berlin buttons (hamburgers), enclose simplemenu links label in span

  • Property exe set to *
Line 
1/*
2* Scut, a collection of Sass utilities to ease and improve our implementations of common style-code patterns.
3* v0.8.0
4* Docs at http://davidtheclark.github.io/scut
5*/
6
7// SCUT CLEARFIX
8// http://davidtheclark.github.io/scut/#clearfix
9
10@mixin scut-clearfix {
11
12  &:after {
13    content: "";
14    display: table;
15    clear: both;
16  }
17
18}
19
20%scut-clearfix {
21  @include scut-clearfix;
22}
23
24// SCUT LIST: UNSTYLED
25// http://davidtheclark.github.io/scut/#list_unstyled
26
27@mixin scut-list-unstyled {
28
29  list-style-type: none;
30  padding-left: 0;
31
32}
33
34%scut-list-unstyled {
35  @include scut-list-unstyled;
36}
37
38// SCUT LIST: FLOATED
39// http://davidtheclark.github.io/scut/#list_floated
40
41// Depends on `list-unstyled` and `clearfix`.
42
43@mixin scut-list-floated (
44  $space: false,
45  $dir: left
46) {
47
48  @include scut-list-unstyled;
49  @include scut-clearfix;
50
51  & > li {
52    float: $dir;
53  }
54
55  @if $space {
56    & > li + li {
57      margin-#{$dir}: $space;
58    }
59  }
60
61}
62
63%scut-list-floated {
64  @include scut-list-floated;
65}
66
67
68// SCUT POSITIONING: COORDINATES
69// http://davidtheclark.github.io/scut/#positioning_coordinates
70
71@function scut-autoOrValue ($val) {
72  @if $val == a or $val == auto {
73    @return auto;
74  }
75  @else {
76    @return $val;
77  }
78}
79
80@mixin scut-coords (
81  $coordinates: n n n n
82) {
83
84  $top: nth($coordinates, 1);
85  $right: nth($coordinates, 2);
86  $bottom: nth($coordinates, 3);
87  $left: nth($coordinates, 4);
88
89  @if $top != n {
90    top: scut-autoOrValue($top);
91  }
92  @if $right != n {
93    right: scut-autoOrValue($right);
94  }
95  @if $bottom != n {
96    bottom: scut-autoOrValue($bottom);
97  }
98  @if $left != n {
99    left: scut-autoOrValue($left);
100  }
101
102}
103
104// SCUT STRIP UNIT
105// http://davidtheclark.github.io/scut/#strip_unit
106
107@function scut-strip-unit (
108  $num
109) {
110
111  @return $num / ($num * 0 + 1);
112
113}
114
115// SCUT PIXELS TO EMS
116// http://davidtheclark.github.io/scut/#pixels-to-ems
117
118// Depends on `scut-strip-unit`.
119
120$scut-em-base: 16 !default;
121
122@function scut-em (
123  $pixels,
124  $base: $scut-em-base
125) {
126
127  // $base could be in em or px (no unit = px).
128  // Adjust accordingly to create a $divisor that
129  // serves as context for $pixels.
130  $multiplier: if(unit($base) == em, 16, 1);
131  $divisor: scut-strip-unit($base) * $multiplier;
132
133  $em-vals: ();
134  @each $val in $pixels {
135    $val-in-ems: (scut-strip-unit($val) / $divisor) * 1em;
136    $em-vals: append($em-vals, $val-in-ems);
137  }
138
139  @if length($em-vals) == 1 {
140    // return a single value instead of a list,
141    // so it can be used in calculations
142    @return nth($em-vals, 1);
143  }
144  @else {
145    @return $em-vals;
146  }
147
148}
149
150// SCUT PIXELS TO REMS
151// http://davidtheclark.github.io/scut/#pixels-to-rems
152
153// Depends on `scut-strip-unit`.
154
155@function scut-rem (
156  $pixels
157) {
158
159  $rem-vals: ();
160  @each $val in $pixels {
161    $val-in-rems: scut-strip-unit($val) / 16 * 1rem;
162    $rem-vals: append($rem-vals, $val-in-rems);
163  }
164
165  @if length($rem-vals) == 1 {
166    // return a single value instead of a list,
167    // so it can be used in calculations
168    @return nth($rem-vals, 1);
169  }
170  @else {
171    @return $rem-vals;
172  }
173
174}
175
176// SCUT BORDER
177// http://davidtheclark.github.io/scut/#border
178
179@mixin scut-border (
180  $style,
181  $sides: n y
182) {
183
184  @if length($sides) == 2 {
185    @if nth($sides, 1) != n {
186      border-top: $style;
187      border-bottom: $style;
188    }
189    @if nth($sides, 2) != n {
190      border-left: $style;
191      border-right: $style;
192    }
193  }
194
195  @else if length($sides) == 4 {
196    @if nth($sides, 1) != n {
197      border-top: $style;
198    }
199    @if nth($sides, 2) != n {
200      border-right: $style;
201    }
202    @if nth($sides, 3) != n {
203      border-bottom: $style;
204    }
205    @if nth($sides, 4) != n {
206      border-left: $style;
207    }
208  }
209
210  @else {
211    @warn "Scut-border requires a $sides argument of 2 or 4 values."
212  }
213
214}
215
216// SCUT CIRCLE
217// http://davidtheclark.github.io/scut/#circle
218
219@mixin scut-circle (
220  $size,
221  $color: inherit
222) {
223
224  border-radius: 50%;
225  display: inline-block;
226
227  @if $color == inherit {
228    // If user wants to inherit the color,
229    // take advantage of the fact that border
230    // color defaults to the text color of the element.
231    border-width: $size / 2;
232    border-style: solid;
233    height: 0;
234    width: 0;
235  }
236  @else {
237    // Otherwise, just use background-color.
238    background-color: $color;
239    height: $size;
240    width: $size;
241  }
242
243}
244
245// SCUT COLOR SWAP
246// http://davidtheclark.github.io/scut/#color_swap
247
248@mixin scut-color-swap (
249  $off,
250  $on,
251  $duration: 0,
252  $bg: false
253) {
254
255  $transition-properties: null;
256  $off-is-list: type-of($off) == list;
257  $on-is-list: type-of($on) == list;
258
259  // If $off IS a list,
260  // assign color and background-color.
261  @if $off-is-list {
262    color: nth($off, 1);
263    background-color: nth($off, 2);
264    $transition-properties: background-color, color;
265  }
266
267  // If $off IS NOT a list and $bg is TRUE,
268  // assign background-color.
269  @else if $bg and not $off-is-list {
270    background-color: $off;
271    $transition-properties: background-color;
272  }
273
274  // If $off IS NOT a list and $bg is FALSE,
275  // assign color.
276  @else {
277    color: $off;
278    $transition-properties: color;
279  }
280
281  // Only set-up transition if $duration != 0.
282  @if $duration != 0 {
283    transition-property: $transition-properties;
284    transition-duration: $duration;
285  }
286
287  &:hover,
288  &:focus {
289
290    // $on is treated the same as $off, above.
291    @if $on-is-list {
292      color: nth($on, 1);
293      background-color: nth($on, 2);
294    }
295
296    @else if $bg and not $on-is-list {
297      background-color: $on;
298    }
299
300    @else {
301      color: $on;
302    }
303  }
304
305}
306
307// SCUT HD BREAKPOINT
308// http://davidtheclark.github.io/scut/#hd_breakpoint
309
310@mixin scut-hd-bp (
311  $ratio: 1.3
312) {
313
314  @media (-o-min-device-pixel-ratio: #{$ratio}/1),
315         (-webkit-min-device-pixel-ratio: #{$ratio}),
316         (min-resolution: #{round(96 * $ratio)}dpi) {
317    @content;
318  }
319
320}
321
322// SCUT HIDE VISUALLY
323// http://davidtheclark.github.io/scut/#hide_visually
324
325@mixin scut-hide-visually {
326
327  border: 0;
328  clip: rect(0 0 0 0);
329  height: 1px;
330  margin: -1px;
331  overflow: hidden;
332  padding: 0;
333  position: absolute;
334  width: 1px;
335
336}
337
338%scut-hide-visually {
339  @include scut-hide-visually;
340}
341
342// SCUT IMAGE REPLACEMENT
343// http://davidtheclark.github.io/scut/#image_replacement
344
345@mixin scut-image-replace {
346
347  text-indent: 102%;
348  white-space: nowrap;
349  overflow: hidden;
350
351}
352
353%scut-image-replace {
354  @include scut-image-replace;
355}
356
357// SCUT REMS WITH FALLBACK
358// http://davidtheclark.github.io/scut/#rems_with_fallback
359
360// Depends on scut-rem and scut-strip-unit
361
362@mixin scut-rem-fallback (
363  $pixels,
364  $property: font-size
365) {
366
367  $px-vals: null;
368  @each $val in $pixels {
369    $val-in-px: scut-strip-unit($val) * 1px;
370    $px-vals: append($px-vals, $val-in-px);
371  }
372  $rem-vals: scut-rem($pixels);
373
374  #{$property}: $px-vals;
375  #{$property}: $rem-vals;
376
377}
378
379// SCUT RESET
380// http://davidtheclark.github.io/scut/#reset
381
382@mixin scut-reset-border-box {
383  // Make everything a border-box, because why not?
384  *, *:before, *:after {
385    -moz-box-sizing: border-box;
386    box-sizing: border-box;
387  }
388}
389
390@mixin scut-reset-antialias {
391  // Antialias!
392  body {
393    -webkit-font-smoothing: antialiased;
394  }
395}
396
397@mixin scut-reset-semanticize {
398  // Make headers and <b> semantic, not presentational.
399  h1,
400  h2,
401  h3,
402  h4,
403  h5,
404  h6 {
405    font-size: 1em;
406    font-weight: normal;
407    margin: 0;
408  }
409  b {
410    font-weight: normal;
411  }
412}
413
414@mixin scut-reset-pointer {
415  // Clickable form elements should have a pointer.
416  label,
417  select,
418  option,
419  button {
420    cursor: pointer;
421  }
422}
423
424@mixin scut-reset-form {
425  fieldset {
426    border: 0;
427    margin: 0;
428    padding: 0;
429  }
430  textarea {
431    resize: vertical;
432  }
433}
434
435@mixin scut-reset-button {
436  // Reset default button styles, which are never used.
437  button,
438  input[type="button"] {
439    background: transparent;
440    border: 0;
441    color: inherit;
442    font: inherit;
443    margin: 0;
444    outline: none;
445    padding: 0;
446    width: auto;
447    -webkit-appearance: none;
448    -webkit-font-smoothing: antialiased;
449    -webkit-user-select: none;
450    -moz-user-select: none;
451    -ms-user-select: none;
452    user-select: none;
453    &::-moz-focus-inner {
454      padding:0;
455      border:0;
456    }
457  }
458}
459
460@mixin scut-reset-paragraph {
461  // Some paragraph margins just get in the way.
462  p:first-of-type {
463    margin-top: 0;
464  }
465  p:last-of-type {
466    margin-bottom: 0;
467  }
468}
469
470// Call them all, minus exclusions!
471@mixin scut-reset ($exclude: false) {
472  @if not index($exclude, border-box) {
473    @include scut-reset-border-box;
474  }
475  @if not index($exclude, antialias) {
476    @include scut-reset-antialias;
477  }
478  @if not index($exclude, semanticize) {
479    @include scut-reset-semanticize;
480  }
481  @if not index($exclude, pointer) {
482    @include scut-reset-pointer;
483  }
484  @if not index($exclude, form) {
485    @include scut-reset-form;
486  }
487  @if not index($exclude, button) {
488    @include scut-reset-button;
489  }
490  @if not index($exclude, paragraph) {
491    @include scut-reset-paragraph;
492  }
493}
494
495// SCUT SELECTED
496// http://davidtheclark.github.io/scut/#selected
497
498@mixin scut-selected (
499  $active: false
500) {
501
502  @if $active {
503    &:hover,
504    &:focus,
505    &:active {
506      @content;
507    }
508  }
509  @else {
510    &:hover,
511    &:focus {
512      @content;
513    }
514  }
515
516}
517
518// SCUT TRIANGLE
519// http://davidtheclark.github.io/scut/#triangle
520
521@mixin scut-triangle (
522  $direction: right,
523  $size: 0.75em,
524  $color: inherit
525) {
526
527  display: inline-block;
528  height: 0;
529  width: 0;
530  // For improved appearance in some Webkit browsers
531  -webkit-transform: rotate(360deg);
532
533  // Set up some variables
534  $width: null;
535  $height: null;
536  $border-widths: null;
537
538  @if type-of($size) == list {
539    $width: nth($size, 1);
540    $height: nth($size, 2);
541  }
542  @else {
543    $width: $size;
544    $height: $size;
545  }
546
547  @if ($direction == up) or ($direction == down) {
548    // For up and down, width gets two borders but height only one,
549    // so divide second border-width value by 2
550    $border-widths: $height ($width / 2);
551  }
552  @else if ($direction == right) or ($direction == left) {
553    // For right and left, height gets two borders but width only one,
554    // so divide first border-width value by 2
555    $border-widths: ($height / 2) $width;
556  }
557  @else {
558    // For right triangles (the rest), both sides get two borders,
559    // so divide both by 2
560    $border-widths: ($height / 2) ($width / 2);
561  }
562
563  border-width: $border-widths;
564  border-style: solid;
565
566
567  // STANDARD TRIANGLES
568
569  @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) {
570    border-color: transparent;
571    @if $direction == up {
572      border-bottom-color: $color;
573      border-top-width: 0;
574    }
575    @else if $direction == right {
576      border-left-color: $color;
577      border-right-width: 0;
578    }
579    @else if $direction == down {
580      border-top-color: $color;
581      border-bottom-width: 0;
582    }
583    @else if $direction == left {
584      border-right-color: $color;
585      border-left-width: 0;
586    }
587  }
588
589
590  // CORNER TRIANGLES
591
592  @else if ($direction == top-right) or ($direction == top-left) {
593    border-top-color: $color;
594    border-bottom-color: transparent;
595    @if $direction == top-right {
596      border-left-color: transparent;
597      border-right-color: $color;
598    }
599    @else if $direction == top-left {
600      border-left-color: $color;
601      border-right-color: transparent;
602    }
603  }
604
605  @else if ($direction == bottom-right) or ($direction == bottom-left) {
606    border-top-color: transparent;
607    border-bottom-color: $color;
608    @if $direction == bottom-right {
609      border-left-color: transparent;
610      border-right-color: $color;
611    }
612    @else if $direction == bottom-left {
613      border-left-color: $color;
614      border-right-color: transparent;
615    }
616  }
617
618}
619
620%scut-triangle {
621  @include scut-triangle;
622}
623
624// SCUT CENTER ABSOLUTELY
625// http://davidtheclark.github.io/scut/#center_absolutely
626
627@mixin scut-center-absolutely (
628  $dimensions
629) {
630
631  $width: nth($dimensions, 1);
632  $height: nth($dimensions, 2);
633
634  position: absolute;
635
636  @if $width != n {
637    width: $width;
638    left: 50%;
639    margin-left: (-$width / 2);
640  }
641
642  @if $height != n {
643    height: $height;
644    top: 50%;
645    margin-top: (-$height / 2);
646  }
647
648}
649
650// SCUT CENTER BLOCK
651// http://davidtheclark.github.io/scut/#center_block
652
653@mixin scut-center-block (
654  $max-width: false
655) {
656
657  margin-left: auto;
658  margin-right: auto;
659  @if $max-width {
660    max-width: $max-width;
661  }
662
663}
664
665%scut-center-block {
666  @include scut-center-block;
667}
668
669
670// SCUT CENTER TRANSFORM
671// http://davidtheclark.github.io/scut/#center_transform
672
673@mixin scut-center-transform (
674  $axis: false // or x or y
675) {
676
677  position: absolute;
678
679  @if $axis != x {
680    top: 50%;
681    margin-top: auto;
682    margin-bottom: auto;
683  }
684
685  @if $axis != y {
686    left: 50%;
687    margin-left: auto;
688    margin-right: auto;
689  }
690
691  $translate-val: null;
692
693  @if not $axis {
694    $translate-val: translate(-50%, -50%);
695  }
696  @else if $axis != x {
697    $translate-val: translateY(-50%);
698  }
699  @else if $axis != y {
700    $translate-val: translateX(-50%);
701  }
702
703  -webkit-transform: $translate-val;
704  -ms-transform: $translate-val;
705  transform: $translate-val;
706}
707
708%scut-center-transform {
709  @include scut-center-transform;
710}
711
712%scut-center-transform-x {
713  @include scut-center-transform(x);
714}
715
716%scut-center-transform-y {
717  @include scut-center-transform(y);
718}
719
720
721// SCUT FILL
722// http://davidtheclark.github.io/scut/#fill
723
724@mixin scut-fill (
725  $width-height: false
726) {
727
728  position: absolute;
729  left: 0;
730  top: 0;
731  @if $width-height {
732    width: 100%;
733    height: 100%;
734  }
735  @else {
736    right: 0;
737    bottom: 0;
738  }
739
740}
741
742%scut-fill {
743  @include scut-fill;
744}
745
746// SCUT FONTICON-LABEL
747// http://davidtheclark.github.io/scut/#fonticon_label
748
749@mixin scut-fonticon-label (
750  $font,
751  $glyph,
752  $space: 0.25em,
753  $side: before
754) {
755
756  &:#{$side} {
757    content: $glyph;
758    font-family: $font;
759    font-style: normal;
760    font-weight: normal;
761    -webkit-font-smoothing: antialiased;
762    display: inline-block;
763    vertical-align: middle;
764
765    @if $side == before and $space != 0 {
766      margin-right: $space;
767    }
768    @else if $side == after and $space != 0 {
769      margin-left: $space;
770    }
771
772    // Add any additional styling.
773    @content;
774
775  }
776
777}
778
779
780// SCUT LIST: CUSTOM
781// http://davidtheclark.github.io/scut/#list_custom
782
783@mixin scut-list-custom (
784  $content: "\2022",
785  $marker-width: 0.75em,
786  $pad: 0
787) {
788
789  $content-val: null;
790  $counter: index($content, count);
791  @if $counter {
792    @if length($content) == 3 {
793      $content-val: counter(scutlistcounter, nth($content, 3))nth($content,2);
794    }
795    @else if length($content) == 2 {
796      $content-val: counter(scutlistcounter)nth($content,2);
797    }
798    @else {
799      $content-val: counter(scutlistcounter);
800    }
801  }
802  @else {
803    $content-val: $content;
804  }
805
806  padding-left: $marker-width + $pad;
807  list-style-type: none;
808
809  & > li {
810    position: relative;
811    @if $counter {
812      counter-increment: scutlistcounter;
813    }
814    &:before {
815      content: $content-val;
816      display: block;
817      position: absolute;
818      top: 0;
819      left: -$marker-width;
820      width: $marker-width;
821      @content;
822    }
823  }
824
825}
826
827// SCUT LIST: DIVIDED
828// http://davidtheclark.github.io/scut/#list_divided
829
830// Depends on `list-floated`, which depends in turn on `list-unstyled` and `clearfix`.
831
832@mixin scut-list-divided (
833  $divider: "|",
834  $space: 0.5em,
835  $dir: left,
836  $height: false
837) {
838
839  @include scut-list-floated($dir: $dir);
840
841  $pseudo: if($dir == left, 'before', 'after');
842
843  // If an explicit height is passed,
844  // things are different: All <li>s
845  // need the pseudo-element (to force height),
846  // but the first's must be hidden.
847
848  @if $height {
849    & > li {
850      height: $height;
851    }
852    & > li:#{$pseudo} {
853      height: $height;
854      content: $divider;
855      display: inline-block;
856      vertical-align: middle;
857      @content;
858    }
859    & > li:first-child:#{$pseudo} {
860      width: 0;
861      overflow: hidden;
862    }
863  }
864
865  & > li + li:#{$pseudo} {
866    @if not $height {
867      content: $divider;
868      display: inline-block;
869      @content;
870    }
871    margin-left: $space;
872    margin-right: $space;
873  }
874
875}
876
877%scut-list-bar {
878  @include scut-list-divided;
879}
880
881%scut-list-breadcrumb {
882  @include scut-list-divided("/");
883}
884
885// SCUT LIST: INLINE
886// http://davidtheclark.github.io/scut/#list_inline
887
888// Depends on `list-unstyled`.
889
890@mixin scut-list-inline (
891  $space: false
892) {
893
894  @include scut-list-unstyled;
895
896  & > li {
897    display: inline-block;
898  }
899
900  @if $space {
901    & > li + li {
902      margin-left: $space;
903    }
904  }
905
906}
907
908%scut-list-inline {
909  @include scut-list-inline;
910}
911
912// SCUT LIST: PUNCTUATED
913// http://davidtheclark.github.io/scut/#list_punctuated
914
915// Depends on `list-unstyled`.
916
917@mixin scut-list-punctuated (
918  $divider: ", ",
919  $display: inline
920) {
921
922  @include scut-list-unstyled;
923  margin-top: 0;
924  margin-bottom: 0;
925
926  & > li {
927    display: $display;
928    &:not(:last-child):after {
929      content: $divider;
930    }
931  }
932
933}
934
935%scut-list-comma {
936  @include scut-list-punctuated;
937}
938
939// SCUT MARGIN
940// http://davidtheclark.github.io/scut/#margin
941
942@mixin scut-margin (
943  $margin
944) {
945
946  @if length($margin) == 1 and $margin != n {
947    margin-top: $margin;
948    margin-right: $margin;
949    margin-bottom: $margin;
950    margin-left: $margin;
951  }
952
953  @if length($margin) == 2 {
954    $margin-y: nth($margin, 1);
955    $margin-x: nth($margin, 2);
956    @if $margin-y != n {
957      margin-top: $margin-y;
958      margin-bottom: $margin-y;
959    }
960    @if $margin-x != n {
961      margin-left: $margin-x;
962      margin-right: $margin-x;
963    }
964  }
965
966  @if length($margin) == 3 {
967    $margin-y-top: nth($margin, 1);
968    $margin-x: nth($margin, 2);
969    $margin-y-bottom: nth($margin, 3);
970    @if $margin-y-top != n {
971      margin-top: $margin-y-top;
972    }
973    @if $margin-x != n {
974      margin-right: $margin-x;
975      margin-left: $margin-x;
976    }
977    @if $margin-y-bottom != n {
978      margin-bottom: $margin-y-bottom;
979    }
980  }
981
982  @if length($margin) == 4 {
983    $margin-top: nth($margin, 1);
984    $margin-right: nth($margin, 2);
985    $margin-bottom: nth($margin, 3);
986    $margin-left: nth($margin, 4);
987    @if $margin-top != n {
988      margin-top: $margin-top;
989    }
990    @if $margin-right != n {
991      margin-right: $margin-right;
992    }
993    @if $margin-bottom != n {
994      margin-bottom: $margin-bottom;
995    }
996    @if $margin-left != n {
997      margin-left: $margin-left;
998    }
999  }
1000
1001}
1002
1003// SCUT PADDING
1004// http://davidtheclark.github.io/scut/#padding
1005
1006@mixin scut-padding (
1007  $padding
1008) {
1009
1010  @if length($padding) == 1 and $padding != n {
1011    padding-top: $padding;
1012    padding-right: $padding;
1013    padding-bottom: $padding;
1014    padding-left: $padding;
1015  }
1016
1017  @if length($padding) == 2 {
1018    $padding-y: nth($padding, 1);
1019    $padding-x: nth($padding, 2);
1020    @if $padding-y != n {
1021      padding-top: $padding-y;
1022      padding-bottom: $padding-y;
1023    }
1024    @if $padding-x != n {
1025      padding-left: $padding-x;
1026      padding-right: $padding-x;
1027    }
1028  }
1029
1030  @if length($padding) == 3 {
1031    $padding-y-top: nth($padding, 1);
1032    $padding-x: nth($padding, 2);
1033    $padding-y-bottom: nth($padding, 3);
1034    @if $padding-y-top != n {
1035      padding-top: $padding-y-top;
1036    }
1037    @if $padding-x != n {
1038      padding-right: $padding-x;
1039      padding-left: $padding-x;
1040    }
1041    @if $padding-y-bottom != n {
1042      padding-bottom: $padding-y-bottom;
1043    }
1044  }
1045
1046  @if length($padding) == 4 {
1047    $padding-top: nth($padding, 1);
1048    $padding-right: nth($padding, 2);
1049    $padding-bottom: nth($padding, 3);
1050    $padding-left: nth($padding, 4);
1051    @if $padding-top != n {
1052      padding-top: $padding-top;
1053    }
1054    @if $padding-right != n {
1055      padding-right: $padding-right;
1056    }
1057    @if $padding-bottom != n {
1058      padding-bottom: $padding-bottom;
1059    }
1060    @if $padding-left != n {
1061      padding-left: $padding-left;
1062    }
1063  }
1064}
1065
1066// SCUT POSITIONING: ABSOLUTE
1067// http://davidtheclark.github.io/scut/#positioning_absolute
1068
1069// Depends on `positioning-coordinates`.
1070
1071@mixin scut-absolute (
1072  $coordinates: 0 n n 0
1073) {
1074
1075  position: absolute;
1076  @include scut-coords($coordinates);
1077
1078}
1079
1080%scut-absolute {
1081  @include scut-absolute;
1082}
1083
1084// SCUT POSITIONING: FIXED
1085// http://davidtheclark.github.io/scut/#positioning_fixed
1086
1087// Depends on `positioning-coordinates`.
1088
1089@mixin scut-fixed (
1090  $coordinates: 0 n n 0
1091) {
1092
1093  position: fixed;
1094  @include scut-coords($coordinates);
1095
1096}
1097
1098%scut-fixed {
1099  @include scut-fixed;
1100}
1101
1102// SCUT POSITIONING: RELATIVE
1103// http://davidtheclark.github.io/scut/#positioning_relative
1104
1105// Depends on `positioning-coordinates`.
1106
1107@mixin scut-relative (
1108  $coordinates: n n n n
1109) {
1110
1111  position: relative;
1112  @include scut-coords($coordinates);
1113
1114}
1115
1116// SCUT RATIO-BOX
1117// http://davidtheclark.github.io/scut/#ratio-box
1118
1119@mixin scut-ratio-box (
1120  $ratio: 1/1,
1121  $inner: ".scut-inner"
1122) {
1123
1124  overflow: hidden;
1125  position: relative;
1126
1127  // The container's height, as a percentage of the
1128  // container's width, is set by assigning
1129  // padding-top to a pseudo-element.
1130  &:before {
1131    content: "";
1132    display: block;
1133    height: 0;
1134    padding-top: (1 / $ratio) * 100%;
1135  }
1136
1137  // The inner element simply fills up the container.
1138  & > #{$inner} {
1139    position: absolute;
1140    left: 0;
1141    top: 0;
1142    width: 100%;
1143    height: 100%;
1144  }
1145
1146}
1147
1148%scut-ratio-box {
1149  @include scut-ratio-box;
1150}
1151
1152// SCUT SIZE
1153// http://davidtheclark.github.io/scut/#size
1154
1155@mixin scut-size(
1156  $size
1157) {
1158
1159  @if length($size) == 1 {
1160    width:  $size;
1161    height: $size;
1162  }
1163  @else if length($size) == 2 {
1164    width:  nth($size, 1);
1165    height: nth($size, 2);
1166  }
1167
1168}
1169
1170// SCUT STICKY FOOTER
1171// http://davidtheclark.github.io/scut/#sticky_footer
1172
1173@mixin scut-sticky-footer (
1174  $height,
1175  $wrapper: ".wrapper",
1176  $footer: ".scut-sticky"
1177) {
1178
1179  html,
1180  body {
1181    height: 100%;
1182  }
1183
1184  #{$wrapper} {
1185    min-height: 100%;
1186    margin-bottom: -$height;
1187    &:after {
1188      content: "";
1189      display: block;
1190    }
1191  }
1192  #{$wrapper}:after,
1193  #{$footer} {
1194    height: $height;
1195  }
1196
1197}
1198
1199// SCUT V-CENTER: INLINE-BLOCK
1200// http://davidtheclark.github.io/scut/#v-center_inline-block
1201
1202@mixin scut-vcenter-ib (
1203  $inner: ".scut-inner"
1204) {
1205
1206  // The inner element is vertically centered
1207  // by middle-aligning it with an inline pseudo-element
1208  // whose height is 100%.
1209
1210  &:before {
1211    content: "";
1212    height: 100%;
1213    display: inline-block;
1214    vertical-align: middle;
1215    // A small negative right margin is set
1216    // to account for the default
1217    // word-spacing of inline-block.
1218    margin-right: -0.25em;
1219  }
1220
1221  & > #{$inner} {
1222    display: inline-block;
1223    vertical-align: middle;
1224  }
1225
1226}
1227
1228%scut-vcenter-ib {
1229  @include scut-vcenter-ib;
1230}
1231
1232
1233// SCUT V-CENTER: LINE-HEIGHT
1234// http://davidtheclark.github.io/scut/#v-center_line-height
1235
1236@mixin scut-vcenter-lh (
1237  $height
1238) {
1239
1240  height: $height;
1241  line-height: $height;
1242
1243}
1244
1245// SCUT V-CENTER: TABLE DISPLAY
1246// http://davidtheclark.github.io/scut/#v-center_table_display
1247
1248@mixin scut-vcenter-td (
1249  $inner: ".scut-inner"
1250) {
1251
1252  display: table;
1253
1254  & > #{$inner} {
1255    display: table-cell;
1256    vertical-align: middle;
1257  }
1258
1259}
1260
1261
1262%scut-vcenter-td {
1263  @include scut-vcenter-td;
1264}
1265
1266// SCUT V-CENTER: TRANSFORM
1267// http://davidtheclark.github.io/scut/#v-center_transform
1268
1269// Depends on scut-center-transform
1270
1271@mixin scut-vcenter-tt () {
1272  @include scut-center-transform(y);
1273}
1274
1275%scut-vcenter-tt {
1276  @include scut-vcenter-tt;
1277}
1278
1279// BOOKENDS
1280// http://davidtheclark.github.io/scut/#bookends
1281
1282@mixin scut-bookends (
1283  $space: 0.5em,
1284  $content: ""
1285) {
1286
1287  $content-list: length($content) == 2;
1288
1289  // If $content is a list or there $space exist,
1290  // set some pseudo-element-specific rules.
1291  @if $content-list or $space {
1292    &:before {
1293      @if $content-list {
1294        content: nth($content, 1);
1295      }
1296      @if $space {
1297        margin-right: $space;
1298      }
1299    }
1300    &:after {
1301      @if $content-list {
1302        content: nth($content, 2);
1303      }
1304      @if $space {
1305        margin-left: $space;
1306      }
1307    }
1308  }
1309
1310  // Then set some rules that apply to both
1311  // pseudo-elements.
1312  &:before,
1313  &:after {
1314    display: inline-block;
1315
1316    @if $content and length($content) == 1 {
1317      content: $content;
1318    }
1319
1320    // Any additional styling applies to both.
1321    @content;
1322
1323  }
1324
1325}
1326
1327// SCUT CSS CHARACTERS
1328// http://davidtheclark.github.io/scut/#characters
1329
1330// space
1331$scut-space: "\0020";
1332// non-breaking space
1333$scut-nbsp: "\00a0";
1334
1335// quotation mark
1336$scut-quot: "\0022";
1337// left single curly quote
1338$scut-lsquo: "\2018";
1339// right single curly quote
1340$scut-rsquo: "\2019";
1341// left double curly quote
1342$scut-ldquo: "\201C";
1343// right double curly quote
1344$scut-rdquo: "\201D";
1345// left single angle quote (guillemet)
1346$scut-lsaquo: "\2039";
1347// right single angle quote (guillemet)
1348$scut-rsaquo: "\203A";
1349// left double angle quote (guillemet)
1350$scut-laquo: "\00ab";
1351// right double angle quote (guillemet)
1352$scut-raquo: "\00bb";
1353
1354// em dash (mutton)
1355$scut-mdash: "\2014";
1356// en dash (nut)
1357$scut-ndash: "\2013";
1358// hyphen
1359$scut-hyphen: "\2010";
1360
1361// ampersand
1362$scut-amp: "\0026";
1363// greater than
1364$scut-gt: "\003e";
1365// less than
1366$scut-lt: "\003c";
1367// times
1368$scut-times: "\00D7";
1369// big times
1370$scut-bigtimes: "\2715";
1371// checkmark
1372$scut-checkmark: "\2713";
1373
1374// section sign (double S, hurricane, sectional symbol, the legal doughnut, signum sectionis)
1375$scut-sect: "\00a7";
1376// paragraph symbol (pilcrow)
1377$scut-para: "\00b6";
1378
1379// middot (interpunct, interpoint)
1380$scut-middot: "\00b7";
1381// o-slash (slashed o)
1382$scut-oslash: "\00f8";
1383// bullet
1384$scut-bull: "\2022";
1385// white bullet
1386$scut-whibull: "\25E6";
1387// horizontal ellipsis
1388$scut-hellip: "\2026";
1389// vertical ellipsis
1390$scut-vellip: "\22EE";
1391// midline horizontal ellipsis
1392$scut-midhellip: "\22EF";
1393
1394// up-pointing triangle
1395$scut-utri: "\25b2";
1396// down-pointing triangle
1397$scut-dtri: "\25bc";
1398// left-pointing triangle
1399$scut-ltri: "\25c0";
1400// right-pointing triangle
1401$scut-rtri: "\25b6";
1402// up-pointing small triangle
1403$scut-ustri: "\25b4";
1404// down-pointing small triangle
1405$scut-dstri: "\25be";
1406// left-pointing small triangle
1407$scut-lstri: "\25c2";
1408// right-pointing small triangle
1409$scut-rstri: "\25b8";
1410// diamond
1411$scut-diamond: "\25c6";
1412// fisheye
1413$scut-fisheye: "\25c9";
1414// bullseye
1415$scut-bullseye: "\25ce";
1416// circle
1417$scut-circle: "\25cf";
1418// white circle
1419$scut-whitecircle: "\25cb";
1420
1421// SCUT FONT-FACE
1422// http://davidtheclark.github.io/scut/#font-face
1423
1424@mixin scut-font-face (
1425  $font-family,
1426  $file-path,
1427  $weight: normal,
1428  $style: normal
1429) {
1430
1431  @font-face {
1432    font-family: $font-family;
1433    font-weight: $weight;
1434    font-style: $style;
1435
1436    src: url('#{$file-path}.eot');
1437    src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
1438         url('#{$file-path}.woff') format('woff'),
1439         url('#{$file-path}.ttf') format('truetype'),
1440         url('#{$file-path}.svg##{$font-family}') format('svg');
1441  }
1442
1443}
1444
1445// SCUT HANGING INDENT
1446// http://davidtheclark.github.io/scut/#hanging_indent
1447
1448@mixin scut-hanging-indent (
1449  $indent: 1em
1450) {
1451
1452  // padding-left creates the indent,
1453  // while text-indent pulls the first line
1454  // back to the edge.
1455
1456  padding-left: $indent;
1457  text-indent: -$indent;
1458
1459}
1460
1461%scut-hanging-indent {
1462  @include scut-hanging-indent;
1463}
1464
1465// SCUT INDENTED PARAGRAPHS
1466// http://davidtheclark.github.io/scut/#indented_paragraphs
1467
1468@mixin scut-indented-ps (
1469  $indent: 1.5em,
1470  $no-first-indent: true
1471) {
1472
1473  p {
1474    margin: 0;
1475    text-indent: $indent;
1476  }
1477
1478  @if $no-first-indent {
1479    p:first-of-type {
1480      text-indent: 0;
1481    }
1482  }
1483
1484}
1485
1486%scut-indented-ps {
1487  @include scut-indented-ps;
1488}
1489
1490// SCUT KEY-VALUE
1491// http://davidtheclark.github.io/scut/#key-value
1492
1493@mixin scut-key-val (
1494  $divider: ":",
1495  $pad: 0.25em,
1496  $indent: 1em,
1497  $spacing: 0,
1498  $pad-left: 0
1499) {
1500
1501  & > dt {
1502    clear: both;
1503    float: left;
1504    &:after {
1505      content: $divider;
1506      margin-right: $pad;
1507      @if $pad-left != 0 {
1508        margin-left: $pad-left;
1509      }
1510    }
1511  }
1512
1513  & > dd {
1514    margin-left: $indent;
1515    @if $spacing != 0 {
1516      margin-bottom: $spacing;
1517    }
1518  }
1519
1520}
1521
1522%scut-key-val {
1523  @include scut-key-val;
1524}
1525
1526// SCUT LINK: BOTTOM-BORDERED
1527// http://davidtheclark.github.io/scut/#link_bottom-bordered
1528
1529@mixin scut-link-bb (
1530  $color: inherit,
1531  $style: solid,
1532  $width: 1px
1533) {
1534
1535  text-decoration: none;
1536
1537  border-bottom-width: $width;
1538  border-bottom-style: $style;
1539  @if $color != inherit {
1540    border-bottom-color: $color;
1541  }
1542
1543}
1544
1545%scut-link-bb {
1546  @include scut-link-bb;
1547}
1548
1549// SCUT REVERSE ITALICS
1550// http://davidtheclark.github.io/scut/#reverse-italics
1551
1552@mixin scut-reverse-italics (
1553  $elements: null
1554) {
1555
1556  $element-list: em, cite, i;
1557  @each $el in $elements {
1558    $element-list: append($element-list, unquote($el), comma)
1559  }
1560
1561  font-style: italic;
1562  #{$element-list} {
1563    font-style: normal;
1564  }
1565
1566}
1567
1568%scut-reverse-italics {
1569  @include scut-reverse-italics;
1570}
1571
1572// SCUT SIDE-LINED
1573// http://davidtheclark.github.io/scut/#side-lined
1574
1575@mixin scut-side-lined (
1576  $height: 1px,
1577  $space: 0.5em,
1578  $color: inherit,
1579  $style: solid,
1580  $v-adjust: false,
1581  $double: false
1582) {
1583
1584  display: block;
1585  overflow: hidden;
1586  text-align: center;
1587
1588  &:before,
1589  &:after {
1590    content: "";
1591    display: inline-block;
1592    vertical-align: middle;
1593    position: relative;
1594    width: 50%;
1595
1596    border-top-style: $style;
1597    border-top-width: $height;
1598
1599    @if $color != inherit {
1600      border-top-color: $color;
1601    }
1602
1603    @if $v-adjust != false {
1604      bottom: $v-adjust;
1605    }
1606
1607    @if $double != false {
1608      height: $double;
1609      border-bottom-style: $style;
1610      border-bottom-width: $height;
1611      @if $color != inherit {
1612        border-bottom-color: $color;
1613      }
1614    }
1615  }
1616
1617  &:before {
1618    right: $space;
1619    margin-left: -50%;
1620  }
1621  &:after {
1622    left: $space;
1623    margin-right: -50%;
1624  }
1625
1626}
1627
1628%scut-side-lined {
1629  @include scut-side-lined;
1630}
1631
1632// SCUT TRUNCATE
1633// http://davidtheclark.github.io/scut/#truncate
1634
1635@mixin scut-truncate {
1636
1637  white-space: nowrap;
1638  overflow: hidden;
1639  text-overflow: ellipsis;
1640
1641}
1642
1643%scut-truncate {
1644  @include scut-truncate;
1645}
Note: See TracBrowser for help on using the repository browser.

Sites map