Help - Search - Members - Calendar
Full Version: Dropdown menu not lining up in list
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
mapguy
It will include the Hover Dropdown in the list but the bullet point is way off to the left. The code im using:

CSS styling: <style>
.dropbtn {
background-color: white;
color: blue;
padding: 0px;
font-size: 16px;
border: none;
cursor: pointer;
btn-indent: 20px;
width: 235px;
}

.dropdown {
position: relative;
display: inline-block;
}

.dropdown-content {
display: none;
position: absolute;
background-color: white;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}

.dropdown-content a {
color: blue;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.dropdown-content a:hover {background-color: #f1f1f1}

.dropdown:hover .dropdown-content {
display: block;
}

.dropdown:hover .dropbtn {
background-color: #f1f1f1;
}
</style>

HTML list: <ul>
<li class="cent" style="margin-left: 20.0px; text-align: left;"><span style="font-size: large;"><a href="https://www.ok.gov/odot/Programs_and_Projects/Metropolitan_Planning/index.html">Metropolitan Planning Orginization (MPO)</a></span></li>
<li class="cent" style="margin-left: 20.0px; text-align: left;"><span style="font-size: large;"><a href="">Regional Transportation Planning Orginization (RTPO)</a></span></li>
    <div class="dropdown">
<button class="dropbtn"><strong>Bicycle & Pedestrian Planning</strong></button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
</ul>

Ill attach the html associated with the code for context.

Thanks in advance
Christian J
QUOTE(mapguy @ Oct 11 2017, 06:46 PM) *

It will include the Hover Dropdown in the list but the bullet point is way off to the left.

You can't put a DIV directly inside a UL, it must be inside an LI element. Maybe that fixes it, otherwise try adding a border to the .dropdown class for debugging.

QUOTE
btn-indent: 20px;

I don't recognize that property. unsure.gif

Also it's more practical to avoid inline styles (i.e. the STYLE attribute), put all CSS in the stylesheet instead.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.