我正在为我的网站使用bootstrap,并希望将此下拉列表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;
}
我在他们提供的样式表中使用了这段代码并将它们导入到文档中不知道还能做什么,替换bootstrap css似乎不是一个好主意
如何将该演示设为默认下拉列表?
我正在寻找这样的事情:
答案 0 :(得分: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;
}
虽然你仍然需要退回箭头
,但它修复了大部分内容