简体   繁体   English

如何使Bootstrap下拉菜单的内容全宽?

[英]How to make Bootstrap dropdown-menu full width of the content?

I have a dropdown-menu in bootstrap with content as pull-right like this: 我在引导程序中有一个dropdown-menu ,其内容如pull-right所示:

<ul class="dropdown-menu pull-right" role="menu">
<li><a href="">Link <span class="pull-right">123</span></li>
</ul>

How do I make it so that both the Link and the 123 are on the same line, no matter how wide it pulls the dropdown-menu ? 我如何使Link123处于同一行,而不管它拉dropdown-menu宽度如何?

Right now, it seems to push the 123 down to the next line if it becomes too wide. 现在,如果它变得太宽,似乎会将123向下推到下一行。

I found a fix by adding min-width: 200px; 我通过添加min-width: 200px;找到了解决方法min-width: 200px; for example, but it's not a nice solution because the menu might or might not contain a number count at all, so it leaves a blank space. 例如,但这不是一个很好的解决方案,因为菜单可能会或可能根本不包含数字计数,因此会留下空白。

Update: It seems that only in Firefox it's jumping to the next line, while Chrome shows it correctly. 更新:似乎只有在Firefox中它才跳到下一行,而Chrome可以正确显示它。

This answered my problem: 这回答了我的问题:

https://github.com/twbs/bootstrap/issues/13876 https://github.com/twbs/bootstrap/issues/13876

It seems that the span pull-right must come BEFORE the text. 似乎跨度右移必须在文本之前出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM