html - CSS checkbox event not working -
html - CSS checkbox event not working -
i'm trying overlay page div (which used menu), when checkbox button checked, doesn't seem work. event not firing?
jsfiddle here.
html
<nav> <div id="topbar"></div> <div id="menutab"><input type="checkbox" id="menutoggle">≡</div> </nav> <section> <div id="slide1" class="slide"> </div> </section>
css
#menutoggle { height: 24px; width: 24px; position: absolute; top: 0; left: 0; margin: 0; padding: 0; cursor: pointer; opacity: 0; } input#menutoggle:checked + #menuoverlay { position:fixed; top:0; left:0; width:100%; opacity:0.95; z-index: 3; } @media screen , (min-width: 0px) , (max-width: 768px) { input#menutoggle:checked + #menuoverlay { background:#000; height:100%; } } @media screen , (min-width: 769px) { input#menutoggle:checked + #menuoverlay { background:#1f1f1f; height:2.4em; } }
you not using right +
selector.
b + e: e element next sibling of b element (that is: next kid of same parent)
you don't have element id #menuoverlay
@ in dom.
the way work current css following:
class="snippet-code-css lang-css prettyprint-override">#menutoggle { height: 24px; width: 24px; position: absolute; top: 0; left: 0; margin: 0; padding: 0; cursor: pointer; opacity: 0; } #menutoggle:checked + #menuoverlay { position:fixed; top:0; left:0; width:100%; opacity:0.95; z-index: 3; } @media screen , (min-width: 0px) , (max-width: 768px) { input#menutoggle:checked + #menuoverlay { background:#000; height:100%; } } @media screen , (min-width: 769px) { input#menutoggle:checked + #menuoverlay { background:#1f1f1f; width:100%; height:100%; } }
class="snippet-code-html lang-html prettyprint-override"><nav> <div id="topbar"></div> <div id="menutab"> <input type="checkbox" id="menutoggle" />≡ <div id="menuoverlay"></div> <!-- add together div element here id menuoverlay --> </div> </nav> <section> <div id="slide1" class="slide"></div> </section>
html css checkbox
Comments
Post a Comment