Reputation: 452
I'm using bootstrap and I have this code :
<ul class="dropdown-menu scrollable-menu-brands" style="width:210px;">
{foreach $arr as $id => $r}
<li><a class="dropdown-item" style="font-size:15px;font-family: PT Sans Narrow,PTSansNarrow;" href="#">{$r}</a></li>
{/foreach}
</ul>
I have this css:
.scrollable-menu-brands {
height: auto;
max-height: 320px;
overflow-x: hidden;
}
.scrollable-menu-brands::-webkit-scrollbar {
-webkit-appearance: none;
}
.scrollable-menu-brands::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid white; /* should match background, can't be transparent */
background-color: rgba(0, 0, 0, .5);
}
.scrollable-menu-brands li a {
height: 10px;
padding-top: 0px;
}
.dropdown-menu > li > a:hover{
background-color: red;
;}
But when hover an element of the list, background color is only for top of my element..
Look this screen:
Someone understand please? I don't understand why height of over is small like this... If I increase height, it doesn't work.
Upvotes: 1
Views: 51
Reputation: 583
@MathAng,
It looks like the height of your A and LI aren't matching the same height, the default height of the LI tag is 26 pixels in height. But at your CSS you're saying that it must be 10 pixels for the A tag.
What I prefer is or use:
.scrollable-menu-brands li a {
padding-top: 0px;
}
instead of:
.scrollable-menu-brands li a {
height: 10px;
padding-top: 0px;
}
Or add height: 10px; to your LI tag, like so:
.scrollable-menu-brands li {
height: 10px;
}
Hopefully this does the trick for you!
Upvotes: 2