tuanphan Posted November 25 Posted November 25 Description A Dropdown with some options Click on each option will open new page in new tab You can follow these steps. #1. First, Add a Code Block #2. Use this code into Code Block <div class="dropdown"> <button class="dropdown-button">Buy the Book</button> <div class="dropdown-menu"> <a href="https://www.amazon.com" target="_blank" class="dropdown-option">Amazon</a> <a href="https://www.apple.com/apple-books/" target="_blank" class="dropdown-option">Apple Books</a> <a href="https://www.barnesandnoble.com" target="_blank" class="dropdown-option">Barnes & Noble</a> </div> </div> <style> .dropdown { position: relative; display: inline-block; } .dropdown-button { padding: 10px 20px; font-size: 16px; background-color: #007BFF; color: white; border: none; border-radius: 50px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; width: 200px; text-align: left; } .dropdown-button::after { content: "▼"; margin-left: auto; font-size: 12px; } .dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background-color: white; border: 1px solid #ccc; border-radius: 4px; box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000; width: 100%; } .dropdown:hover .dropdown-menu { display: block; } .dropdown-option { display: block; padding: 3px 15px; color: #333; text-decoration: none; font-size: 14px; } .dropdown-option:hover { background-color: #f0f0f0; } </style> #3. Result #4. Customize To change dropdown text/url, change these To change dropdown style, change these Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
helloluci Posted November 29 Posted November 29 Thank you so much! I am going to give this a try this weekend. tuanphan 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment