Hide TOC with CSS instead of JavaScript
[lhc/web/wiklou.git] / resources / src / mediawiki.toc.styles / screen.less
1 /* This style adds a toggle button with internationalized message for the TOC. */
2
3 /* When the browser supports :checked then overwrite the style="display:none" and make the /*
4 /* checkbox invisible on another way to allow to focus the checkbox with keyboard. */
5 :not( :checked ) > .toctogglecheckbox {
6 display: inline !important; /* stylelint-disable-line declaration-no-important */
7 position: absolute;
8 opacity: 0;
9 }
10
11 .toctogglespan {
12 font-size: 94%;
13 }
14
15 /* IE8 does not support :checked and therefor it does not support the hiding at all. */
16 /* The selector ":not( :checked ) >" prevents that the useless brackets are shown on IE8. */
17 :not( :checked ) > .toctogglespan:before {
18 content: ' [';
19 }
20
21 :not( :checked ) > .toctogglespan:after {
22 content: ']';
23 }
24
25 /* Make the label look like a link. */
26 .toctogglelabel {
27 cursor: pointer;
28 color: #0645ad;
29 }
30
31 .toctogglelabel:hover {
32 text-decoration: underline;
33 }
34
35 /* Show a focus ring around the label when focusing the invisible checkbox. */
36 /* This simulates that the label is in focus. */
37 .toctogglecheckbox:focus + .toctitle .toctogglelabel {
38 text-decoration: underline;
39 outline: dotted 1px; /* Firefox style for focus */
40 outline: auto -webkit-focus-ring-color; /* Webkit style for focus */
41 }
42
43 /* Change the text of the button based on the state of the checkbox. */
44 .toctogglecheckbox:checked + .toctitle .toctogglelabel:after {
45 content: '@{msg-showtoc}';
46 }
47
48 .toctogglecheckbox:not( :checked ) + .toctitle .toctogglelabel:after {
49 content: '@{msg-hidetoc}';
50 }