summaryrefslogtreecommitdiffstats
path: root/reverse-dependance.html
blob: b496bc19073d5cabe88ad5c8628d8312cd7de3d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html>
  <head>
    <title>CSS Reverse Dependance</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style>
      /* +-----------------------------------------------------------------------+ *\
      |* | reversed dependance                                                   | *|
      |* | (c) 2014 Michał "rysiek" Woźniak <rysiek@hackerspace.pl>              | *|
      \* +-----------------------------------------------------------------------+ */
      /*
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
      */
      .parent {
        font-family:sans-serif;
        position:relative;
        background:#ddd;
      }
      .parent > p:first-child,
      .parent > p:first-child + p,
      .parent > p:first-child + p + p {
        text-indent:1.5em;
        margin:0px;
      }
      .parent .indicator {
        display:block;
        width:1px;
        height:1px;
        position:absolute;
        top:0.1em;
        left:0.2em;
      }
      .parent .indicator::before {
        content:" ";
        display:inline-block;
        font-size:100%;
        border:solid 0.15em black;
        color:black;
        width:0.6em;
        height:0.6em;
        line-height:0.6em;
        border-radius:0.1em;
      }
      /* any checkboxes checked? */
      .parent > :checked ~ .indicator.any::before {
        content:"✔";
      }
      /* some two checkboxes right nedt to each other checked? */
      .parent .indicator.side-by-side {
        top:1.2em;
      }
      .parent > input:checked + input:checked ~ .indicator.side-by-side::before {
        content:"✔";
      }
      /* all checkboxes checked? */
      .parent .indicator.all {
        top:2.4em;
      }
      .parent .indicator.all::before {
        content:"✔";
      }
      .parent > input:not(:checked) ~ .indicator.all::before {
        content:" ";
      }
    </style>
  </head>
  <body>
    <div class="parent">
      <p>Any of the checkboxes checked?</p>
      <p>At least 2 checkboxes side by side checked?</p>
      <p>All of the checkboxes checked?</p>
      <input type="checkbox" name="dependable1" title="Checkbox 1"/>
      <input type="checkbox" name="dependable2" title="Checkbox 2"/>
      <input type="checkbox" name="dependable3" title="Checkbox 3"/>
      <input type="checkbox" name="dependable3" title="Checkbox 3"/>
      <input type="checkbox" name="dependable4" title="Checkbox 4"/>
      <span class="indicator any"></span>
      <span class="indicator side-by-side"></span>
      <span class="indicator all"></span>
    </div>
    <p>This is one if the <a href="http://rys.io/en/123/">neat hacss</a>. Code is <a href="https://code.hackerspace.pl/rysiek/neat-hacss/">here</a>.</p>
  </body>
</html>