Advertisement
1xptolevitico69

Dropdown List

Dec 22nd, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.20 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Dropdown List</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width">
  7. <style>
  8.  
  9. .sel {  font-size:25px;display:block;margin:20px 5px;
  10.           font-family:arial;font-weight:900;cursor:pointer;  }
  11.  
  12.  
  13. #box {   width:150px;height:40px;border:1px solid;
  14.               overflow-y:scroll;overflow-x:hidden;   }
  15.  
  16.  
  17. #bt { width:150px;height:40px;font-size:25px;font-family:arial;
  18.          font-weight:900;padding:0 0 15px 0;border:none;outline:none;
  19.        position:fixed;   }
  20.  
  21.  
  22. </style>
  23. </head>
  24. <body>
  25.  
  26.  
  27. <div id='box'>
  28. <button id='bt'>Select</button>
  29. <span style='margin-top:60px;' class='sel'>Blue</span>
  30. <span class='sel'>Red</span>
  31. <span class='sel'>Green</span>
  32. <span class='sel'>Olive</span>
  33. <span class='sel'>Navy</span>
  34. <span class='sel'>White</span>
  35. <span class='sel'>Blue</span>
  36. <span class='sel'>Red</span>
  37. <span class='sel'>Green</span>
  38. <span class='sel'>Olive</span>
  39. <span class='sel'>Navy</span>
  40. <span class='sel'>White</span>
  41. </div>
  42.  
  43.  
  44.  
  45.  
  46. <script>
  47.  
  48. i=0;
  49.  
  50. bt.onclick=()=>{
  51. if(i==0){i++;
  52. box.style.height='400px';
  53. }else if(i==1){i--;
  54. box.style.height='40px';
  55. }
  56. }
  57.  
  58.  
  59.  
  60. </script>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement