html-код
<section class="container-fluid">
<div class="col">
<div class="row justify-content-md-center">
<div class="col nav-color card-border">
<ul class="nav nav-pills">
<li class="container-custom topBotomBordersIn dropdown">
<button class="btn-custom-animated dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">nav1dropdown</button>
<div class="dropdown-menu">
<button class="btn-custom-animated">dropdown1</button>
<button class="btn-custom-animated">dropdown2</button>
<button class="btn-custom-animated">dropdown3</button>
</div>
</li>
<li class="container-custom topBotomBordersIn">
<button class="btn-custom-animated">nav2</button>
<button class="btn-custom-animated">nav3</button>
</li>
</ul>
</div>
</div>
</div>
</section>
css-код
.center-pills {
display: flex;
justify-content: center;
}
.nav-color {
background-color:deepskyblue;
}
.dropdown-menu {
background-color: deepskyblue !important;
}
.btn-custom-animated {
background-color: transparent;
border: none;
box-shadow: none;
outline: none;
}
.btn-custom-animated.active.focus,
.btn-custom-animated.active:focus,
.btn-custom-animated.focus,
.btn-custom-animated.focus:active,
.btn-custom-animated:active:focus,
.btn-custom-animated:focus {
outline: 0 !important;
outline-offset: 0 !important;
background-image: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
background-color: transparent;
border: none;
box-shadow: none;
outline: none;
}
li.container-custom {
font-family: Raleway;
margin: 0 auto;
/*padding: 10em 3em;*/
text-align: center;
}
li.container-custom button {
color: #FFF;
text-decoration: none;
font: 20px Raleway;
margin: 0px 10px;
padding: 10px 10px;
position: relative;
z-index: 0;
cursor: pointer;
}
/* Top and Bottom borders come in */
li.topBotomBordersIn button:before, li.topBotomBordersIn button:after {
position: absolute;
left: 0px;
width: 100%;
height: 2px;
background: #FFF;
content: "";
opacity: 0;
transition: all 0.3s;
}
li.topBotomBordersIn button:before {
top: 0px;
transform: translateY(-10px);
}
li.topBotomBordersIn button:after {
bottom: 0px;
transform: translateY(10px);
}
li.topBotomBordersIn button:hover:before, li.topBotomBordersIn button:hover:after {
opacity: 1;
transform: translateY(0px);
}
jsfiddle.net
В этом проекте я использую Bootstrap 4 со всеми плагинами js.
Я не могу понять причину, по которой первая кнопка (выпадающий список) имеет другую нижнюю строку во время анимации.В jsfiddle кнопки навигации в выпадающем списке также не работают, но в проекте они анимируются правильно.