- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
HTML code for a drop down button
Can someone help please with some code. I need to place a button on my page with a drop down options menu. Weebly doesn't give an option for this and has only told me to go to W3 Schools for tutorials. I have done this but no matter what I do the code doesn't seem to drop down once I place in my weebly site page. Does anyone have any code they could share that works on a weebly site please?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
What code are you using and what's the URL of the page of your site where you added this, @sarahcarr?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Hi Adam
I don't think it is right but the code I am using is -
<div class="dropdown">
<button class="dropbtn">Hibiscus Coast Business Directory Sections</button>
<div class="dropdown-content">
<a href="https://www.linku2hibiscuscoast.co.nz/hibiscus-coast-local-business-quick-guide.html">Coast Local Quick Business Links</a>
<a href="https://www.linku2hibiscuscoast.co.nz/hibicus-coast-business-features.html">Business Features</a>
<a href="#">Link 3</a>
</div>
</div>
<br />
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.dropbtn {
background-color: #F67606;
color: white;
padding: 16px;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 300px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #0056d6;}
</style>
</head>
<body>
<h3>Click Above for Business Directory Sections</h3>
<p>These lead to our second level categories</p>
<div class="dropdown">
<button class="dropbtn">Dropdown</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
</body>
</html>
For some reason it only works showing two buttons which is annoying and the top button is the only one that works - I did at one stage get it to work with 4 menus but I have about 17 to add to the drop down.
I was going to do a hover button but understand this is not good for mobile viewers so think perhaps it is best to have a button that is clicked on for the drop down to appear. I'd really appreciate your help
Sarah
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Try using just this:
<style> .dropbtn { background-color: #F67606; color: white; padding: 16px; font-size: 16px; border: none; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f1f1f1; min-width: 300px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content a:hover {background-color: #ddd;} .dropdown:hover .dropdown-content {display: block;} .dropdown:hover .dropbtn {background-color: #0056d6;} </style> <div class="dropdown"> <button class="dropbtn">Hibiscus Coast Business Directory Sections</button> <div class="dropdown-content"> <a href="https://www.linku2hibiscuscoast.co.nz/hibiscus-coast-local-business-quick-guide.html">Coast Local Quick Business Links</a> <a href="https://www.linku2hibiscuscoast.co.nz/hibicus-coast-business-features.html">Business Features</a> <a href="#">Link 3</a> </div> </div>
Some of the tags that are included with what you have now could break the display of the site.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Hi Adam
Thanks for your help - unfortunately that code doesn't work either - I've put it on this page so you can check
https://www.linku2hibiscuscoast.co.nz/linku2-hibiscus-coast-contact.html
Sarah
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Try this instead:
<style> #512019927167895105 { overflow: visible !important; } .dropbtn { background-color: #F67606; color: white; padding: 16px; font-size: 16px; border: none; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f1f1f1; min-width: 300px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content a:hover {background-color: #ddd;} .dropdown:hover .dropdown-content {display: block;} .dropdown:hover .dropbtn {background-color: #0056d6;} </style> <div class="dropdown"> <button class="dropbtn">Hibiscus Coast Business Directory Sections</button> <div class="dropdown-content"> <a href="https://www.linku2hibiscuscoast.co.nz/hibiscus-coast-local-business-quick-guide.html">Coast Local Quick Business Links</a> <a href="https://www.linku2hibiscuscoast.co.nz/hibicus-coast-business-features.html">Business Features</a> <a href="#">Link 3</a> </div> </div>
Our embed code element hides overflow by default, so the extra code I added will override that.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
No it still doesn't work!
Sarah
https://www.linku2hibiscuscoast.co.nz/linku2-hibiscus-coast-contact.html
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Did you paste this into a new Embed Code element? The code update I gave specific to the element it was in before, since we assign a unique ID to each element.
Try this instead:
<style> .wcustomhtml { overflow: visible !important; } .dropbtn { background-color: #F67606; color: white; padding: 16px; font-size: 16px; border: none; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f1f1f1; min-width: 300px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content a:hover {background-color: #ddd;} .dropdown:hover .dropdown-content {display: block;} .dropdown:hover .dropbtn {background-color: #0056d6;} </style> <div class="dropdown"> <button class="dropbtn">Hibiscus Coast Business Directory Sections</button> <div class="dropdown-content"> <a href="https://www.linku2hibiscuscoast.co.nz/hibiscus-coast-local-business-quick-guide.html">Coast Local Quick Business Links</a> <a href="https://www.linku2hibiscuscoast.co.nz/hibicus-coast-business-features.html">Business Features</a> <a href="#">Link 3</a> </div> </div>
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Sorry for the delay - yes thanks Adam that seems to work now! Thank you for your help
Sarah
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Awesome! Glad to hear that.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Hi Adam
Tried the code and it works on desktop but not on mobile, any tip on how to make it work on phone and tablets?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
How is it not working on mobile for you, @rafael56?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report
- Subscribe to RSS Feed
- Mark Thread as New
- Mark Thread as Read
- Float this Thread for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Is this still active?
I need to make two buttons have drop down menus that lead to individual pages. How can this be done? Thank you!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report