1 @import "mediawiki.mixins";
2 @import "mediawiki.ui/variables";
6 // Styling checkboxes in a way that works cross browser is a tricky problem to solve.
7 // In MediaWiki UI put a checkbox and label inside a mw-ui-checkbox div.
8 // This renders in all browsers except IE6-8 which do not support the :checked selector;
9 // these are kept backwards-compatible using the :not(#noop) selector.
10 // You should give the checkbox and label matching "id" and "for" attributes, respectively.
13 // <div class="mw-ui-checkbox">
14 // <input type="checkbox" id="kss-example-5"><label for="kss-example-5">Standard checkbox</label>
16 // <div class="mw-ui-checkbox">
17 // <input type="checkbox" id="kss-example-5-checked" checked><label for="kss-example-5-checked">Standard checked checkbox</label>
19 // <div class="mw-ui-checkbox">
20 // <input type="checkbox" id="kss-example-5-disabled" disabled><label for="kss-example-5-disabled">Disabled checkbox</label>
22 // <div class="mw-ui-checkbox">
23 // <input type="checkbox" id="kss-example-5-disabled-checked" disabled checked><label for="kss-example-5-disabled-checked">Disabled checked checkbox</label>
28 display: inline-block;
29 vertical-align: middle;
34 // We use the not selector to cancel out styling on IE 8 and below
35 .mw-ui-checkbox:not(#noop) {
36 // Position relatively so we can make use of absolute pseudo elements
38 line-height: @checkboxSize;
41 vertical-align: middle;
44 input[type="checkbox"] {
45 // we hide the input element as instead we will style the label that follows
46 // we use opacity so that VoiceOver software can still identify it
48 // ensure the invisible checkbox takes up the required width
50 height: @checkboxSize;
52 // the pseudo before element of the label after the checkbox now looks like a checkbox
61 display: inline-block;
62 border-radius: @borderRadius;
65 height: @checkboxSize;
66 background-color: #fff;
67 border: 1px solid grey;
71 // when the input is checked, style the label pseudo before element that followed as a checked checkbox
75 .background-image-svg('images/checked.svg', 'images/checked.png');
76 .background-size( @checkboxSize, @checkboxSize );
77 background-repeat: no-repeat;
78 background-position: center top;
83 @focusBottomBorderSize: 0.2em;
91 height: @checkboxSize - @focusBottomBorderSize + 0.08; // offset by bottom border
92 // offset from the checkbox by 1px to account for left border
94 border-bottom: solid @focusBottomBorderSize lightgrey;
99 // disabled checked boxes have a gray background
104 background-color: lightgrey;