--- title: Dropdowns --- ## Dropdowns Dropdowns are used in CSS to hide a predefined list within a button. Examples: ```html ``` Then you should customise the classes in css ```css .dropdown { position: relative; display: inline-block; } .dropbtn { background-color: red; padding: 10px; } .dropdown-content { display: none; position: absolute; } .dropdown:hover .dropdown-content { display:block; } ``` You need the separate div classes to create the button, and another div to separate the list of what the button contains. #### An Example ```html
×
``` ```css #myNav1 { height: 0; width: 50%; position: fixed; z-index: 6; top: 0; left: 0; background-color: #ffff; overflow: hidden; transition: 0.3s; opacity: 0.85; } #myNav2 { height: 0; width: 50%; position: fixed; z-index: 6; bottom: 0; right: 0; background-color: #ffff; overflow: hidden; transition: 0.3s; opacity: 0.85; } .overlay-content { position: relative; width: 100%; text-align: center; margin-top: 30px; } #myNav1-content{ top: 12%; left: 5%; display: none; } #myNav2-content{ top: 12%; right: 10%; display: none; } ``` #### More Information: * W3 School Dropdown Hover Button: Link to W3 School * W3 School Dropdowns: Link to W3 School