【问题标题】:Dropdown CSS conflict下拉 CSS 冲突
【发布时间】:2014-01-18 11:16:03
【问题描述】:

我正在为我的网站使用引导程序,并希望将此下拉菜单 http://tympanus.net/Tutorials/CustomDropDownListStyling/index3.html 作为默认下拉菜单集成到我的导航栏中。

我上传了资源并尝试实现它,但没有成功,结果如下:

我想在导航中切换下拉菜单的按钮上保持相同的样式,并且只更改下拉菜单本身,并设法做到完全相反。 这是带有 css 的导航条码:http://jsfiddle.net/MikeStardust/z5WQ4/

演示中显示的自定义下拉菜单的 CSS 代码:

.wrapper-dropdown-3 {
/* Size and position */
position: relative;
width: 200px;
margin: 0 auto;
padding: 10px;

/* Styles */
background: #fff;
border-radius: 7px;
border: 1px solid rgba(0,0,0,0.15);
box-shadow: 0 1px 1px rgba(50,50,50,0.1);
cursor: pointer;
outline: none;

/* Font settings */
font-weight: bold;
color: #8AA8BD;
}

.wrapper-dropdown-3:after {
content: "";
width: 0;
height: 0;
position: absolute;
right: 15px;
top: 50%;
margin-top: -3px;
border-width: 6px 6px 0 6px;
border-style: solid;
border-color: #8aa8bd transparent;
}
.wrapper-dropdown-3 .dropdown {
/* Size & position */
position: absolute;
top: 140%;
left: 0;
right: 0;

/* Styles */
background: white;
border-radius: inherit;
border: 1px solid rgba(0,0,0,0.17);
box-shadow: 0 0 5px rgba(0,0,0,0.1);
font-weight: normal;
transition: all 0.5s ease-in;
list-style: none;

/* Hiding */
opacity: 0;
pointer-events: none;
}

.wrapper-dropdown-3 .dropdown li a {
display: block;
padding: 10px;
text-decoration: none;
color: #8aa8bd;
border-bottom: 1px solid #e6e8ea;
box-shadow: inset 0 1px 0 rgba(255,255,255,1);
transition: all 0.3s ease-out;
}

.wrapper-dropdown-3 .dropdown li i {
float: right;
color: inherit;
}

.wrapper-dropdown-3 .dropdown li:first-of-type a {
border-radius: 7px 7px 0 0;
}

.wrapper-dropdown-3 .dropdown li:last-of-type a {
border-radius: 0 0 7px 7px;
border: none;
}

/* Hover state */

.wrapper-dropdown-3 .dropdown li:hover a {
background: #f3f8f8;
}

.wrapper-dropdown-3 .dropdown:after {
content: "";
width: 0;
height: 0;
position: absolute;
bottom: 100%;
right: 15px;
border-width: 0 6px 6px 6px;
border-style: solid;
border-color: #fff transparent;    
}

.wrapper-dropdown-3 .dropdown:before {
content: "";
width: 0;
height: 0;
position: absolute;
bottom: 100%;
right: 13px;
border-width: 0 8px 8px 8px;
border-style: solid;
border-color: rgba(0,0,0,0.1) transparent;    
}

.wrapper-dropdown-3.active .dropdown {
opacity: 1;
pointer-events: auto;
}

我在他们提供的样式表中使用了这段代码并将它们导入到文档中不知道还能做什么,替换引导 css 似乎不是一个好主意

如何使该演示成为我的默认下拉菜单?

我正在寻找这样的东西:

【问题讨论】:

  • 你还有什么问题??
  • 如何使该演示成为我的默认下拉菜单
  • 提供一个小提琴,其中至少显示/工作下拉...
  • @Danko:它在问题中,jsfiddle.net/pVwh9 但 OP 忘记在其中添加 jquery 文件..请做必要的:)
  • 小提琴不起作用...?

标签: html css twitter-bootstrap drop-down-menu


【解决方案1】:

首先是添加这些:

.navbar-default .dropdown-menu {
    background-color: #ffffff !important;
}

.navbar-nav > li > .dropdown-menu {
    margin-top: 10px;
    border-radius: 10px;
}

.wrapper-dropdown-3 {
    position: relative;
    width: 200px;
    margin: 0 auto;
    border-radius: 7px;
    border: none;
    box-shadow: 0 1px 1px rgba(50,50,50,0.1);
    cursor: pointer;
    outline: none;
    font-weight: 300;
    color: #8AA8BD;
}

虽然您仍然需要找回箭头,但大部分问题都已解决

【讨论】:

  • 没有箭头的完美前夜,我该如何修理胡佛?只是圆角,我可以改变颜色
  • 自己修好了:) 非常感谢:)
猜你喜欢
  • 1970-01-01
  • 2012-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多