Twitter Bootstrap下拉菜单宽度 [英] Twitter Bootstrap dropdown menu width

查看:134
本文介绍了Twitter Bootstrap下拉菜单宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的目标: https:// docs。 google.com/file/d/0B13W1jkpc_BzLXZ6RGxGbUd2NG8/edit?usp=sharing

这是我的方法的CSS:

Here is the CSS for my approach:

@media (min-width: 980px) {
.dropdown-menu .sub-menu {
  left: 100%;
  position: absolute;
  top: 0;
  visibility: hidden;
  margin-top: -1px;
}
ul.nav li.dropdown:hover > ul.dropdown-menu {
  display: block;
}
a.menu:after, .dropdown-toggle:after {
  content: none;
}
.navbar .dropdown-menu {
  margin-top: 0px;
  text-align: center;
}}

现在看起来如此: https://docs.google.com/file/d/0B13W1jkpc_BzZUlRck5VcWh0TkE/edit?usp=sharing

一切都正常,除了我似乎无法获得下拉菜单文本的正确宽度(我需要根据文本缩小宽度)。那么我该怎么做?

Everything is working fine except that i can't seem to get the right width for the dropdown menu's text (i need to shrink the width according to text). So how do i do that ?

推荐答案

你必须删除最小宽度 .dropdown-menu 列表中的$ c>属性。包括 之后的包括引导:

You have to remove the min-width property of the .dropdown-menu list. Including the following after you include bootstrap:

.dropdown-menu {
  min-width: 0px;
}

或者,对于您给出的确切样式,您可以使用 bootstrap的工具提示,而不是

Alternatively, for the exact style you have given, you could use bootstrap's tooltips instead

这篇关于Twitter Bootstrap下拉菜单宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆