gpt4 book ai didi

jquery - 中间有箭头的下拉菜单

转载 作者:太空宇宙 更新时间:2023-11-04 16:20:12 25 4
gpt4 key购买 nike

我正在尝试创建一个像这里那样的下拉菜单,但我没有成功地正确设计它的样式。

我要创建的菜单类似于找到的菜单 here

示例:

enter image description here

这就是我目前所拥有的!

http://jsfiddle.net/9ggfz0st/1/

@import url('http://getbootstrap.com/dist/css/bootstrap.css');
.dropdown-menu:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.dropdown-menu:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}
<div class="dropdown">
<a data-toggle="dropdown" href="#">Dropdown trigger</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
Account Settings<hr>Billing
</ul>
</div>

我无法将箭头居中到中间,还应用了“下拉菜单动画效果”

如何使箭头居中?

最佳答案

为了改变箭头的位置,只需像这样改变 left 的值:

.dropdown-menu:before {
position: absolute;
top: -7px;
left: 40%;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}

.dropdown-menu:after {
position: absolute;
top: -6px;
left: 40%;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}

JSFiddle

关于jquery - 中间有箭头的下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29997953/

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