我想在移動模式、頂部和粘性模式下垂直對齊“漢堡”選單。我試過這種方式,它可以在粘性模式下作業,但不能在頂級模式下作業:
.banner.navbar.navbar-default.navbar-static-top button
{
margin-top: 20px !important;
}
我的網站如下:鏈接
源代碼:
<header class="banner navbar navbar-default navbar-static-top " role="banner" data-transparent-header="false">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div id="logo">
<a href="https://www.atvmototraveler.ro/">
<img data-rjs="2" class="logo-trans logo-reg" src="https://www.atvmototraveler.ro/wp-content/uploads/2022/10/atv_de_inchiriat_inchirieri_atv_inchirieri_motociclete_cluj_cluj_napoca_atvmototraveler-61x61@2x.png" alt="Atvmototraveler" data-rjs-processed="true" width="61" height="61">
<img data-rjs="2" class="logo-main logo-reg" src="https://www.atvmototraveler.ro/wp-content/uploads/2022/10/inchirieri_atv-inchiriat_inchirieri_atv_cluj_inchiriere_atv_de_inchiriat_rent_atv_cluj_logo-1-301x300@2x.png" alt="Atvmototraveler" data-rjs-processed="true" width="80" height="80">
</a>
</div>
</div>
<div class="themo_cart_icon"><a href="https://www.atvmototraveler.ro/cart/"><i class="th-icon th-i-cart3"></i></a></div>
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation" style="height: 0px;">
<ul id="menu-atv-de-inchiriat-meniu" class="nav navbar-nav"><li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home current-menu-item page_item page-item-312 current_page_item menu-item-447"><a href="https://www.atvmototraveler.ro/" aria-current="page"><i class="fa fa-home"></i> ?nchirieri ATV</a></li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1245"><a href="https://www.atvmototraveler.ro/trasee/"><i class="fas fa-map-signs"></i> Trasee</a></li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1207"><a href="https://www.atvmototraveler.ro/flota/"><i class="fas fa-truck-monster"></i> Flota</a></li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1645"><a href="https://www.atvmototraveler.ro/despre-noi/"><i class="far fa-building"></i> Despre Noi</a></li>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-724"><a href="https://www.atvmototraveler.ro/contact/"><i class="fas fa-envelope"></i> Contact</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-557"><a href="https://www.atvmototraveler.ro/product/inchirieaza-atv-cluj/"><i class="fas fa-key"></i> Rezerv? Acum</a></li>
</ul> </nav>
</div>
</header>
uj5u.com熱心網友回復:
嘗試添加顯示彈性。
header .container>.navbar-header::after, .container>.navbar-header::before {
content: none;
}
header .container>.navbar-header {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row-reverse;
width: 100%;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/530114.html
