html - Bootstrap3 下拉菜单对齐

标签 html css twitter-bootstrap-3

我正在为我的元素使用 bootstrap3,并在我在代码片段网站上找到的工具中添加了一个大菜单。

当我添加菜单时,我试图让它在按钮下方对齐,但它偏向右侧。

我试过了,但没有任何改变。

.dropdown-large{ 左:继承 }

如果需要,可以在这里找到示例代码:http://bootsnipp.com/snippets/featured/large-dropdown-menu

enter image description here

这是菜单背后的 CSS:

.dropdown-large {
  position: static !important;
}
.dropdown-menu-large {
  margin-left: 16px;
  margin-right: 16px;
  padding: 20px 0px;
}
.dropdown-menu-large > li > ul {
  padding: 0;
  margin: 0;
}
.dropdown-menu-large > li > ul > li {
  list-style: none;
}
.dropdown-menu-large > li > ul > li > a {
  display: block;
  padding: 3px 20px;
  clear: both;
  font-weight: normal;
  line-height: 1.428571429;
  color: #333333;
  white-space: normal;
}
.dropdown-menu-large > li ul > li > a:hover,
.dropdown-menu-large > li ul > li > a:focus {
  text-decoration: none;
  color: #262626;
  background-color: #f5f5f5;
}
.dropdown-menu-large .disabled > a,
.dropdown-menu-large .disabled > a:hover,
.dropdown-menu-large .disabled > a:focus {
  color: #999999;
}
.dropdown-menu-large .disabled > a:hover,
.dropdown-menu-large .disabled > a:focus {
  text-decoration: none;
  background-color: transparent;
  background-image: none;
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  cursor: not-allowed;
}
.dropdown-menu-large .dropdown-header {
  color: #428bca;
  font-size: 18px;
}
@media (max-width: 768px) {
  .dropdown-menu-large {
    margin-left: 0 ;
    margin-right: 0 ;
  }
  .dropdown-menu-large > li {
    margin-bottom: 30px;
  }
  .dropdown-menu-large > li:last-child {
    margin-bottom: 0;
  }
  .dropdown-menu-large .dropdown-header {
    padding: 3px 15px !important;
  }
}

我怎样才能将菜单向左移动更多?

更新:这是问题的一个 fiddle 。拖动窗口要大;您将在页面右侧看到它是如何成为静态位置的。 http://jsfiddle.net/MV9tL/embedded/result/

最佳答案

我能想到的唯一不会弄乱其他功能的是以下内容:

演示:http://jsbin.com/raxuli/1

不要使用 !important,在媒体查询之外更具体:

.dropdown.dropdown-large {
  position: static;
}

添加到您的 css 的末尾:

@media (min-width: 1300px) { 
    .dropdown-menu-large {
        min-width: 600px; /*needs a width or add width to the stuff inside it */
    }

    .navbar-nav .dropdown.dropdown-large {
        position: relative
    }
}

关于html - Bootstrap3 下拉菜单对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25125125/

相关文章:

Javascript |翻页不适用于本地系统

jquery - 窗口未正确调整大小

css - 显示导航栏折叠按钮的最小宽度(浏览器)

javascript - 如何在 AngularJS 部分模板中包含第 3 方 JavaScript 库?

javascript - 提交一个 php 表单并在不重新加载页面的情况下在 div 上显示其结果

css - 行内 block 样式

html - 垂直对齐 div 内的两个元素

html - 当父元素被另一个子元素填充得更高时,强制元素达到 100% 高度

html - CSS:3 个 div,一个固定大小,其他带有可滚动表格的动态

javascript - 如何使用下拉选项隐藏和显示按钮?