我試圖讓菜單按鈕和搜索按鈕並排放在標題中,但似乎沒有任何工作。下面是我目前正在獲取的圖片以及按鈕的相關標記和樣式。按鈕不會並排
HTML:
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
<button type="button" id="searchbuttonmobile" ><img src="~/Images/SearchBtn.png" /></button>
<button type="button" onclick="openNav()" class="navbar-toggle" data-toggle="collapse" data-target=".mobilenav" id="menubutton">
<img src="~/Images/MobileMenuBtn.png" />
</button>
</div>
CSS:
/*----------------------------------*/
/*---MOBILE MENU LOGO AND BUTTONS---*/
/*----------------------------------*/
@media (max-width: 400px) {
#logo {
width: 100px;
}
#smokefree {
padding-left: 5px;
padding-top: 20px;
}
#smokefree a {
font-size: 14pt;
}
#menubutton img {
width: 43px;
height: 44px;
}
#searchbuttonmobile {
padding: 9px 0px;
}
#searchbuttonmobile img {
width: 43px;
height: 44px;
}
}
/*--------------------------------------*/
/*--------MENU BUTTON APPEARANCE--------*/
/*--------------------------------------*/
@media (max-width: 1279px) {
.navbar-header {
float: none;
}
.navbar-left, .navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 10px;
}
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
background-color: transparent;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse, .desktopnav {
display: none !important;
}
#mobilenav {
display: block;
}
#searchbuttonmobile {
padding: 9px 10px;
display: inline;
}
.navbar-nav {
float: none !important;
margin-top: 7.5px;
}
.navbar-nav > li {
float: none;
}
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in {
display: block !important;
}
}
按鈕默認情況下,塊元素(如在顯示:塊;)你想要做的是添加'display:inline-block'到你的按鈕css :) – ThisGuyHasTwoThumbs
無法重現,你發佈的代碼不是足夠 –
@ThisGuyHasTwoThumbs試過,他們仍然保持堆疊。 :-( –