源码
<div class="container">
<div class="drop drop--down"><button class="btn">Dropdown</button>
<div class="drop__content">
<div class="drop-arrow"></div>
<div class="drop-list -size-large -position-right -border-rounded">
<button class="drop-list__btn">Bootstrapmb.Com</button>
<button class="drop-list__btn">jqueryScript.Com</button>
<button class="drop-list__btn">Google.Com</button>
</div>
</div>
</div>
<div class="drop drop--up"><button class="btn">Dropup</button>
<div class="drop__content">
<div class="drop-arrow"></div>
<div class="drop-list -size-medium -position-right">
<button class="drop-list__btn">Action 1</button>
<button class="drop-list__btn">Action 2</button>
</div>
</div>
</div>
<div class="drop drop--down -color-lighter"><button class="btn">Light Theme</button>
<div class="drop__content">
<div class="drop-arrow"></div>
<div class="drop-list -size-medium -position-right">
<button class="drop-list__btn">Action 1</button>
<button class="drop-list__btn">Action 2</button>
</div>
</div>
</div>
</div>
<style>
.container {
margin: 150px auto;
max-width: 960px;
text-align: center;
}
.btn{
padding: 1.25rem;
border: 0;
border-radius: 3px;
background-color: #4F46E5;
color: #fff;
cursor: pointer;
}
.drop {
cursor: pointer;
display: inline-block;
min-width: 14px;
overflow: visible;
position: relative;
text-align: center;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-smoothing: antialiased
}
.drop.is-disabled {
cursor: not-allowed
}
.drop__content {
position: absolute;
visibility: hidden;
width: 100%
}
.drop--down .drop__content {
top: 100%
}
.drop--up .drop__content {
bottom: 100%
}
.drop:not(.is-disabled).is-open .drop__content,.drop:not(.is-disabled):hover .drop__content {
visibility: visible
}
.drop__content.-transition-fade-in {
opacity: 0;
transition: visibility 0s linear,opacity .25s ease-in;
transition-delay: .1s
}
.drop.is-open .drop__content.-transition-fade-in,.drop:hover .drop__content.-transition-fade-in {
opacity: 1;
transition-delay: 0s
}
.drop__content.-transition-slide-in {
opacity: 0;
transition: visibility 0s linear,opacity .25s ease,transform .25s ease;
transition-delay: .1s
}
.drop--up .drop__content.-transition-slide-in {
transform: translateY(-10px)
}
.drop--down .drop__content.-transition-slide-in {
transform: translateY(10px)
}
.drop.is-open .drop__content.-transition-slide-in,.drop:hover .drop__content.-transition-slide-in {
opacity: 1;
transform: translateY(0);
transition-delay: 0s
}
.drop-arrow {
border-left: 7px solid transparent;
border-right: 7px solid transparent;
height: 0;
margin: 0 auto;
width: 0
}
.drop--up .drop-arrow {
border-top: 7px solid #373737;
margin-bottom: 2px
}
.drop--down .drop-arrow {
border-bottom: 7px solid #373737;
margin-top: 2px
}
.drop--up.-color-secondary .drop-arrow {
border-top-color: #148a73
}
.drop--down.-color-secondary .drop-arrow {
border-bottom-color: #148a73
}
.drop--up.-color-lighter .drop-arrow {
border-top-color: #bdc3c7
}
.drop--down.-color-lighter .drop-arrow {
border-bottom-color: #bdc3c7
}
.drop-list {
min-width: 100%;
background-color: #373737;
font-size: .8em;
font-weight: 400;
list-style: none;
margin: 0;
padding: 5px;
position: absolute;
white-space: nowrap
}
.drop.-color-secondary .drop-list {
background-color: #148a73
}
.drop.-color-lighter .drop-list {
background-color: #bdc3c7
}
.drop--down .drop-list {
top: 100%
}
.drop--up .drop-list {
bottom: 100%
}
.drop-list.-position-left.-pull-left {
margin-right: 10.5px
}
.drop-list.-position-left.-pull-right {
margin-right: -10.5px
}
.drop-list.-position-center.-pull-left {
margin-left: -10.5px
}
.drop-list.-position-center.-pull-right {
margin-left: 10.5px
}
.drop-list.-position-right.-pull-left {
margin-left: -10.5px
}
.drop-list.-position-right.-pull-right {
margin-left: 10.5px
}
.drop-list.-position-center {
left: 50%;
transform: translateX(-50%)
}
.drop-list.-position-left {
right: 0
}
.drop-list.-position-right {
left: 0
}
.drop-list.-size-medium {
width: 150px
}
.drop-list.-size-large {
width: 225px
}
.drop-list.-border-rounded {
border-radius: 5px
}
.drop--down .drop-list::before,.drop--up .drop-list::after {
content: " ";
height: 19px;
left: 0;
position: absolute;
width: 100%
}
.drop--down .drop-list::before {
bottom: 100%
}
.drop--up .drop-list::after {
top: 100%
}
.drop-list__item {
display: block
}
.drop-list__btn {
background-color: transparent;
border: 0;
border-radius: 2px;
color: #FFF;
cursor: pointer;
font: inherit;
display: block;
outline: 0;
padding: 11.2px;
text-align: left;
text-decoration: none;
width: 100%
}
.drop-list__btn.is-selected {
background-color: #565656
}
.drop.-color-secondary .drop-list__btn.is-selected {
background-color: #1cbfa0
}
.drop.-color-lighter .drop-list__btn.is-selected {
background-color: #a7afb4
}
.drop-list__btn:hover {
background-color: #515151
}
.drop.-color-secondary .drop-list__btn:hover {
background-color: #1ab798
}
.drop.-color-lighter .drop-list__btn:hover {
background-color: #a1aab0
}
</style>