[英]How to right align / justify bootstrap dropdown menu items?
I'm trying to align the items within a standard bootstrap dropdown menu to the right hand side within the menu. 我正在尝试将标准引导程序下拉菜单中的项目与菜单中的右侧对齐。 Normally they are left aligned.
通常,它们保持对齐。
I need this because I'm displaying languages that are read Right To Left (RTL). 我需要这个,因为我正在显示从右到左(RTL)读取的语言。
Nothing I try seems to work properly, using "pull-right" class on any element, eg the <li>
, <a>
or <span>
all fail when hovering over an item - eg hilight is wrong size or shape. 我尝试过的任何事情似乎都无法正常工作,在任何元素上使用“ pull-right”类,例如将
<li>
, <a>
或<span>
悬停在某个项目上时都将失败,例如,hilight的尺寸或形状错误。
Note that the dropdown-menu-right
class in the <ul>
only aligns the whole menu container with the parent button, not the items within the menu with the container (which is what I want). 请注意,
<ul>
中的dropdown-menu-right
类仅使整个菜单容器与父按钮对齐,而不使菜单内的项目与容器对齐(这是我想要的)。 Code currently is: 当前代码是:
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="#"><span dir="rtl">جديد ...</span></a></li>
<li><a href="#"><span dir="rtl">حفظ ...</span></a></li>
<li><a href="#"><span dir="rtl">تحميل ...</span></a></li>
<li><a href="#"><span dir="rtl">نص عادي (العادية) المشاركة ...</span></a></li>
<li class="divider"></li>
<li><a href="#" id="quitapp"><span dir="rtl"><i class="fa fa-close fa-lg fa-fw"></i> الإقلاع عن التدخين ...
</span></a></li>
</ul>
(Note: I need the <span dir="rtl">
to make sure text is displayed in the right direction, and want to keep the overall look of the menu (so not sure about converting to <divs>
or <listgroups>
) (注意:我需要
<span dir="rtl">
来确保文本以正确的方向显示,并且想要保持菜单的整体外观(因此不确定要转换为<divs>
或<listgroups>
)
Any suggestions / solutions much appreciated! 任何建议/解决方案表示赞赏! I'm using Bootstrap 3.3.5
我正在使用Bootstrap 3.3.5
Many thanks 非常感谢
You can use style = "text-align : right;"
您可以使用
style = "text-align : right;"
for the a
tags. 对于
a
标签。 It should work. 它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.