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-2" disabled><label for="kss-example-5-2">Disabled checkbox</label>
22 display: inline-block;
23 vertical-align: middle;
28 // We use the not selector to cancel out styling on IE 8 and below
29 .mw-ui-checkbox:not(#noop) {
30 // Position relatively so we can make use of absolute pseudo elements
32 line-height: @checkboxSize;
35 vertical-align: middle;
38 input[type="checkbox"] {
39 // we hide the input element as instead we will style the label that follows
40 // we use opacity so that VoiceOver software can still identify it
42 // ensure the invisible checkbox takes up the required width
44 height: @checkboxSize;
46 // the pseudo before element of the label after the checkbox now looks like a checkbox
55 display: inline-block;
56 border-radius: @borderRadius;
59 height: @checkboxSize;
60 background-color: #fff;
61 border: 1px solid grey;
65 // when the input is checked, style the label pseudo before element that followed as a checked checkbox
69 .background-image-svg('images/checked.svg', 'images/checked.png');
70 .background-size( @checkboxSize, @checkboxSize );
71 background-repeat: no-repeat;
72 background-position: center top;
77 @focusBottomBorderSize: 3px;
85 height: @checkboxSize - @focusBottomBorderSize + 1; // offset by bottom border
86 // offset from the checkbox by 1px to account for left border
88 border-bottom: solid @focusBottomBorderSize lightgrey;
93 // disabled checked boxes have a gray background
98 background-color: lightgrey;