gpt4 book ai didi

html - 更改 Bootstrap 下拉以向右水平放置

转载 作者:太空狗 更新时间:2023-10-29 14:41:48 35 4
gpt4 key购买 nike

我有一个下拉菜单,可以在其下方打开一排图标(见图 1,名称和图片已被删除以保护隐私) enter image description here

我正在尝试使此菜单在选择子项的右侧打开,而不是在其下方(参见图 2,我正在尝试获取的内容。图像将在下拉菜单的右侧打开,而不是在下方打开它) enter image description here

我当前的代码是:

<div class="span4">      
<div class="btn-group">
<a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
<h3>Choose Child</h3>
<img id="mainIcons" src="boyStudent.png" alt="boyStudent">
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<div class="btn-group">
<a href="parent_homepage_2.html" style="text-align:center;" class="btn btn-link operationsButtons">
<h5>A</h5>
<img id="mainIcons" src="boyStudent.png" alt="boyStudent"></a>
<a href="parent_homepage_2.html" style="text-align:center;" class="btn btn-link operationsButtons">
<h5>J</h5>
<img id="mainIcons" src="girlStudent.png" alt="girlStudent"></a>
</div>
</li>
</ul>

我尝试使用以下示例,它有助于将下拉菜单推向左侧 how to make twitter bootstrap submenu to open on the left side?但我想不出一种方法来将它用于我想要做的事情

谢谢

最佳答案

这看起来如何:-

Demo

Demo2下拉子菜单。

<div class="span4">
<div class="btn-group"> <a class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="#">
<h3>Choose Child</h3>
<img id="mainIcons" src="boyStudent.png" alt="boyStudent">
<span class="right-caret right"></span>
</a>

<ul class="dropdown-menu rightMenu">
<li>
<div class="btn-group"> <a href="parent_homepage_2.html" style="text-align:center;" class="btn btn-link operationsButtons">
<h5>A</h5>
<img id="mainIcons" src="boyStudent.png" alt="boyStudent"></a>
<a href="parent_homepage_2.html" style="text-align:center;" class="btn btn-link operationsButtons">
<h5>J</h5>
<img id="mainIcons" src="girlStudent.png" alt="girlStudent"></a>

</div>
</li>
</ul>
</div>

CSS

   .rightMenu {
position:relative;
float:right;
}
.right-caret {

border-bottom: 4px solid transparent;
border-top: 4px solid transparent;
border-left: 4px solid #000000;
display: inline-block;
height: 0;
opacity: 1;
vertical-align: top;
width: 0;

}
.right
{
float:right;
}

关于html - 更改 Bootstrap 下拉以向右水平放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16409266/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com