lundi 10 octobre 2016

How to stop dropdown list appearing on top of list item

So I'm trying to configure a simple dropdown list from a list item but I can't for the life of me figure out why it wont stop covering the list item when I hover over it. Here's the html:

<div class="dropdown" style="float:right">
                <li><a class="active dropbtn" href="">Profile</a></li>
                <div class="dropdown-content">
                <a href="#">Link 1</a>
                <a href="#">Link 2</a>
                <a href="logout.php?logout"><span class="glyphicon   glyphicon-log-out"></span>&nbsp; Logout</a></a>
                </div>
            </div>

And the css to style this is:

tr:hover {background-color: #f5f5f5}
th, td {
padding: 15px;
text-align: left;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 10;
}

/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}

/* Change the background color of the dropdown button when the dropdown     content is shown */
.dropdown:hover .dropbtn {
background-color: #3e8e41;

In addition to this, despite changing the z-index of the dropdown elements I can't get the menu to appear outside of the menu where the parent list is located

All help is appreciated




Aucun commentaire:

Enregistrer un commentaire