I am having a problem with my hamburger icon and checkbox input.
What I expect to happen is for the checkbox to be completely invisible but still be able to check it which will then trigger the transition where my hamburger icon forms into a cross with the middle span turning invisible.
What I need to fix:
- Border around input when not checked.FIXED border: none & outline:none
- Checkbox having a black background when checked. FIXED Upgraded mobile browsers and not occuring anymore.
- Middle span staying visible. FIXED Solution I found was using different cross browser opacity stylings.
Here is the HTML:
<div class="menu-icon">
<input type="checkbox" name="checkbox" value="">
<span></span>
<span></span>
<span></span>
</div>
Here is the CSS:
.menu-icon input, .menu-icon input:checked {
-webkit-appearance: none;
-webkit-border-radius:0px;
opacity: 0%;
position: absolute;
width: 50px;
height: 50px;
z-index: 5;
}
.menu-icon span {
transition: all 0.4s ease-in-out;
margin-bottom: 10px;
background: black;
width: 40px;
height: 3px;
border-radius: 10px;
}
.menu-icon input:checked ~ span:first-of-type {
transform: rotate(45deg) translate(9px, 9px);
}
.menu-icon input:checked ~ span:nth-child(3) {
opacity: 0%;
}
.menu-icon input:checked ~ span:last-of-type {
transform: rotate(-45deg) translate(10px, -10px);
}
.menu-icon span:last-of-type {
margin-bottom: 0;
}
Pictures of what is happening: Before After
I have tried looking at previous posts and on google but I can't seem to find anything regarding my specific problem.
As you can see I've tried adding some webkits but to no success.
Thank you in advance.