Edit This Code:
See Result »
<!DOCTYPE html> <html> <title>W3.CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../lib/w3.css"> <body class="w3-container"> <h2>Clickable Dropdown</h2> <p>Click on the button to open the dropdown menu.</p> <div class="w3-dropdown-click"> <button onclick="myFunction()" class="w3-btn">Button</button> <div id="Demo" class="w3-dropdown-content w3-card-4"> <a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> </div> </div> <script> function myFunction() { document.getElementById("Demo").classList.toggle("w3-show"); } </script> </body> <!-- Mirrored from www.w3schools.com/w3css/tryit.asp?filename=tryw3css_dropdown_click by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 13 Mar 2016 11:04:49 GMT --> </html>
Result: