Merge "Move section ID fallbacks into headers themselves"
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / icons.less
1 @import 'mediawiki.mixins';
2 @import 'mediawiki.ui/variables';
3
4 // Mixins
5 .mixin-mw-ui-icon-bgimage( @iconSvg, @iconPng ) {
6 &.mw-ui-icon {
7 &:before {
8 .background-image-svg( @iconSvg, @iconPng );
9 }
10 }
11 }
12
13 // Icons
14 //
15 // To use icons you must be using a browser that supports pseudo elements.
16 // This includes support for IE 8.
17 // http://caniuse.com/#feat=css-gencontent
18 //
19 // For elements that are intended to have both an icon and text, browsers that
20 // do not support pseudo-selectors will degrade to text-only.
21 //
22 // However, icon-only elements do not yet degrade to text-only elements in these
23 // browsers.
24 //
25 // Styleguide 6.
26
27 .mw-ui-icon {
28 position: relative;
29 line-height: @iconSize;
30 min-height: @iconSize;
31 min-width: @iconSize;
32
33 // Standalone icons
34 //
35 // Markup:
36 // <div class="mw-ui-icon mw-ui-icon-element mw-ui-icon-ok">OK</div><br>
37 // <div class="mw-ui-icon mw-ui-icon-element mw-ui-icon-ok mw-ui-button mw-ui-progressive">OK</div><br>
38 // <button class="mw-ui-icon mw-ui-icon-ok mw-ui-icon-element mw-ui-button mw-ui-quiet" title="">Close</button>
39 //
40 // Styleguide 6.1.1.
41 &.mw-ui-icon-element {
42 @marginIcon: 2 * @iconGutterWidth;
43 @width: @iconSize + @marginIcon;
44 @sizeIconLarge: ( @iconSize * 1.75) + @marginIcon;
45
46 text-indent: -999px;
47 overflow: hidden;
48 width: @width;
49 min-width: @width;
50 max-width: @width;
51
52 &:before {
53 left: 0;
54 right: 0;
55 position: absolute;
56 margin: 0 @iconGutterWidth;
57 }
58
59 &.mw-ui-icon-large {
60 width: @sizeIconLarge;
61 min-width: @sizeIconLarge;
62 max-width: @sizeIconLarge;
63 line-height: @sizeIconLarge;
64 min-height: @sizeIconLarge;
65
66 &:before {
67 min-height: @sizeIconLarge;
68 }
69 }
70 }
71
72 &.mw-ui-icon-before:before,
73 &.mw-ui-icon-element:before {
74 background-position: 50% 50%;
75 background-repeat: no-repeat;
76 background-size: 100% auto;
77 float: left;
78 display: block;
79 min-height: @iconSize;
80 content: '';
81 }
82
83 // Icons with text
84 //
85 // Markup:
86 // <div class="mw-ui-icon mw-ui-icon-before mw-ui-icon-ok">OK</div>
87 // <div class="mw-ui-icon mw-ui-icon-before mw-ui-icon-ok mw-ui-progressive mw-ui-button">OK</div>
88 //
89 // Styleguide 6.1.2
90 &.mw-ui-icon-before {
91 &:before {
92 position: relative;
93 width: @iconSize;
94 margin-right: @iconGutterWidth;
95 }
96 }
97
98 // Icons small for elements like indicators
99 //
100 // Markup:
101 // <div class="mw-ui-icon mw-ui-icon-small mw-ui-icon-help"></div>
102 //
103 // Styleguide 6.1.3
104 &.mw-ui-icon-small:before {
105 background-size: 66.67% auto; // 66.67% of 24px equals 16px
106 }
107 }