1 @import "mediawiki.mixins";
5 // Styling checkboxes in a way that works cross browser is a tricky problem to solve.
6 // In MediaWiki UI put a checkbox and label inside a mw-ui-checkbox div.
7 // This renders in all browsers except IE6-8 which do not support the :checked selector;
8 // these are kept backwards-compatible using the :not(#noop) selector.
9 // You should give the checkbox and label matching "id" and "for" attributes, respectively.
12 // <div class="mw-ui-checkbox">
13 // <input type="checkbox" id="kss-example-5"><label for="kss-example-5">Standard checkbox</label>
15 // <div class="mw-ui-checkbox">
16 // <input type="checkbox" id="kss-example-5-2" disabled><label for="kss-example-5-2">Disabled checkbox</label>
21 display: inline-block;
22 vertical-align: middle;
27 // We use the not selector to cancel out styling on IE 8 and below
28 .mw-ui-checkbox:not(#noop) {
29 // Position relatively so we can make use of absolute pseudo elements
31 line-height: @checkboxSize;
34 vertical-align: middle;
37 input[type="checkbox"] {
38 // we hide the input element as instead we will style the label that follows
39 // we use opacity so that VoiceOver software can still identify it
41 // ensure the invisible checkbox takes up the required width
43 height: @checkboxSize;
45 // the pseudo before element of the label after the checkbox now looks like a checkbox
51 display: inline-block;
55 height: @checkboxSize;
56 background-color: #fff;
58 border: 1px solid grey;
62 // when the input is checked, style the label pseudo before element that followed as a checked checkbox
66 .background-image-svg('images/checked.svg', 'images/checked.png');
67 background-repeat: no-repeat;
68 background-position: center top;
73 @focusBottomBorderSize: 3px;
81 height: @checkboxSize - @focusBottomBorderSize + 1; // offset by bottom border
82 // offset from the checkbox by 1px to account for left border
84 border-bottom: solid @focusBottomBorderSize lightgrey;
89 // disabled checked boxes have a gray background
90 &:disabled + label::before {
91 background-color: lightgrey;