Hello everyone this may seem easy to many people, But I just don't get it why transition
is not working when I click the radio button to show the hidden side nav.
So I am creating a side nav using only html and css and I found out the I can use radio button as a way to show and hide content. I accomplished the show and hide part but then I decided to put a transition
css so that after I click the show button it will not show instantly but with transition same goes with the hide/close button.
Below is my code snippet
*{
padding: 0;
margin: 0;
}
.nav {
display: none;
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 5s ease-in;
padding-top: 60px;
color: white;
}
#show:checked ~ .nav {
display: block;
z-index: 1;
width: 250px;
-webkit-transition: all 1s linear;
-moz-transition: all 1s linear;
-ms-transition: all 1s linear;
-o-transition: all 1s linear;
transition: all 1s linear;
}
#close:checked ~ .nav {
display: none;
background: rgb( 40, 44, 47 );
opacity: 0.7;
-webkit-transition: all 1s linear;
-moz-transition: all 1s linear;
-ms-transition: all 1s linear;
-o-transition: all 1s linear;
transition: all 1s linear;
}
<header class="header">
<input type="radio" name="side" id="show">show
<nav class="nav">
<ul>
<input type="radio" name="side" id="close">close
<li>Home</li>
<li>About</li>
<li>Task sheets</li>
<li>Poftfolio</li>
<li>Contacts</li>
</ul>
</nav>
</header>
<h1>Hello</h1>