Hello there,
I have a dropdown list that I want to keep from moving elements as I hover over it.
When I hover over a category item, the container below moves as the drop-down descends. I want the container to stay at the same spot.
What is the best solution for this? Appreciate the help.
Edit: here’s the HTML and CSS code for this:
<div class="menu js-top-menu position-static hidden-sm-down" id="_desktop_top_menu">
<ul class="top-menu" id="top-menu" data-depth="0">
<li class="category" id="category-16">
<a class="dropdown-item" href="http://thestripedphoenix.com/store/index.php?id_category=16&controller=category" data-depth="0">
<span class="float-xs-right hidden-md-up">
<span data-target="#top_sub_menu_90236" data-toggle="collapse" class="navbar-toggler collapse-icons">
<i class="material-icons add"></i>
<i class="material-icons remove"></i>
</span>
</span>
Nature Photography
</a>
<div class="popover sub-menu js-sub-menu collapse" id="top_sub_menu_90236">
<ul class="top-menu" data-depth="1">
<li class="category" id="category-17">
<a class="dropdown-item dropdown-submenu" href="http://thestripedphoenix.com/store/index.php?id_category=17&controller=category" data-depth="1">
Flowers
</a>
</li>
<li class="category" id="category-18">
<a class="dropdown-item dropdown-submenu" href="http://thestripedphoenix.com/store/index.php?id_category=18&controller=category" data-depth="1">
Ground
</a>
</li>
</ul>
</div>
</li>
<li class="category" id="category-11">
<a class="dropdown-item" href="http://thestripedphoenix.com/store/index.php?id_category=11&controller=category" data-depth="0">
Architecture Photography
</a>
</li>
</ul>
<div class="clearfix"></div>
</div>
#_desktop_top_menu {
text-transform: uppercase;
font-weight: 1em;
text-align: center;
margin-bottom: 50px;
display: flex;
justify-content: center;
}
#_desktop_top_menu a {
-o-transition: color 0.2s ease, border-bottom-color 0.2s ease;
-moz-transition: color 0.2s ease, border-bottom-color 0.2s ease;
-webkit-transition: color 0.2s ease, border-bottom-color 0.2s ease;
-ms-transition: color 0.2s ease, border-bottom-color 0.2s ease;
transition: color 0.2s ease, border-bottom-color 0.2s ease;
color: #232323;
text-decoration: none;
}
#_desktop_top_menu ul {
display: flex;
}
ul#top-menu {
position: absolute;
z-index: 99999;
}
.dropdown-item {
display: block;
width: 100%;
clear: both;
text-align: inherit;
white-space: nowrap;
background: none;
border: 0;
position: relative;
}
.top-menu .sub-menu.collapse {
display: none;
}
.top-menu .popover {
max-width: inherit;
border-radius: 0;
positon: initial;
}
.top-menu .sub-menu {
box-shadow: 2px 1px 11px 2px rgba(0,0,0,.1);
border: none;
margin-left: .9375rem;
width: calc(100% - 30px);
min-width: calc(100% - 30px);
z-index: 18;
}
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1060;
display: block;
max-width: 276px;
padding: 1px;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;
font-style: normal;
font-weight: 400;
letter-spacing: normal;
line-break: auto;
line-height: 1.5;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
white-space: normal;
word-break: normal;
word-spacing: normal;
font-size: .875rem;
word-wrap: break-word;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.2);
border-radius: .3rem;
}