My dropdown menu is dropping towards the right correctly, but it is going downwards and getting hidden under my page. I want it to open upwards instead of downwards.
I attempted to adjust the CSS, adding bottom:0
to the dropdown-menu
, but unfortunately, it did not have the desired effect. I also experimented with nesting a dropdown-menu-right
in a dropup
, but the menu ended up being displayed in a top-right diagonal position, not aligned with the button.
Here is the complete code for my dropdown:
<div class="dropright" style="position: relative;">
<button class="btn btn-primary btn-block" style="font-size: large;" onblur="this.nextSibling.style.display='none'" onclick="this.nextSibling.style.display='block'" >
<img src="/assets/Images/Avatar.jpg" class="rounded-circle" style="height:30px;width:30px; padding: 0;" alt="Avatar">
</button>
<div class="dropdown-menu" style="position: absolute;">
<a class="dropdown-item" href="">Action</a>
<a class="dropdown-item" href="">Another action</a>
<a class="dropdown-item" href="">Something else here</a>
<a class="dropdown-item" href="">Something else here</a>
</div>
</div>
Here is what I envision for my dropdown.
Here is the issue I am facing.