【发布时间】:2019-07-27 17:48:11
【问题描述】:
我的下拉菜单正确地向右下降,但向下,这导致它隐藏在我的页面下。我希望它向上而不是向下打开。
我尝试摆弄 CSS,将 bottom:0 添加到 dropdown-menu,但没有奏效。我还尝试在dropup 中嵌套dropdown-menu-right,但显示的菜单与按钮不一致(它位于右上角的对角线)。
这是我的下拉列表的完整代码:
<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>
This是我想要的
This 是问题
【问题讨论】:
标签: html css drop-down-menu bootstrap-4