html - Menu list doesn't appear in div as expected -


i want create navigation menu sidebar.

it should have links ul list not displaying on div element

i want using css only.

pure css required because don't have scripting language knowledge

<!doctype html>     <html lang="en">         <head>             <title>sidebar</title>             <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=material+icons             "/>             <style type="text/css">                 /*                  #button {                  display: block;                  text-decoration: none;                  margin-top: 20px;                  margin-left: 50px;                  color: white;                  width: 20px;                  height:20px;                  font-size: 30px;                  transition: width 0.5s;                  background-color: black;                  text-align: center;                  padding-bottom: 30px;                  box-sizing: border-box;                  }*/                  #button {                     margin-top: 20px;                     margin-left: 50px;                     font-size: 30px;                     cursor: hand;                 }                  #sidebar {                     position: absolute;                     background-color: black;                     left: 0px;                     top: 0px;                     width: 0px;                     height: 100%;                     transition: width 0.5s;                     opacity: 0.7;                 }                  #screen {                     position: fixed;                     background-color: tan;                     height: 100%;                     width: 100%;                     left: 0px;                     top: 0px;                 }                  #button:hover + #sidebar {                     width: 200px;                 }                  #sidebar:hover {                     width: 200px;                 }              </style>         </head>          <body>              <div id="screen">                  <i class="material-icons" id="button">menu</i>                  <div id="sidebar">                     <ul>                         <li><a href="#1">nav 1</a></li>                         <li><a href="#2">nav 2</a></li>                         <li><a href="#3">nav 3</a></li>                     </ul>                 </div>                  <hr />                 <div>                     hello                 </div>             </div>          </body>     </html> 

because in css have #sidebar{ width: 0px;} ul cannot contained inside div, instead play left value rather width jsfiddle

#button {       margin-top: 20px;       margin-left: 50px;       font-size: 30px;       cursor: hand;   }  #sidebar {       position: absolute;       background-color: black;       left: -200px;       top: 0px;       width: 200px;       height: 100%;       transition: width 0.5s;       opacity: 0.7;       padding-top:50px;   -webkit-transition: left 1s;  transition: left 1s;   }   #sidebar ul {   list-style-type:none;   }   #screen {   position: fixed;   background-color: tan;   height: 100%;   width: 100%;   left: 0px;   top: 0px;   }   #sidebar:hover, #button:hover + #sidebar {   left: 0;   -webkit-transition: left 1s;  transition: left 1s;   }
<div id="screen"><i class="material-icons" id="button">menu</i>        <div id="sidebar">          <ul>              <li><a href="#1">nav 1</a></li>              <li><a href="#2">nav 2</a></li>              <li><a href="#3">nav 3</a></li>          </ul>      </div>      <hr />      <div>hello</div>  </div>

note: added transition: left 1s; make transition of sliding page , out -webkit- supporting issues


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -