0
我想顯示導航欄菜單項和內嵌塊中的搜索按鈕窗體,因爲它顯示爲兩行。如何顯示導航欄菜單項和搜索按鈕窗體內嵌塊
這裏是我的代碼
HTML
<div class="col-md-4 col-md-offset-3">
<form action="" class="search-form">
<div class="form-group has-feedback">
<label for="search" class="sr-only">Search</label>
<input type="text" class="form-control" name="search" id="search" placeholder="search">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
</div>
</form>
</div>
<div class="col-sm-6 col-xs-8">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">My Account</a></li>
<li><a href="#">Sign In</a></li>
<li><a href="#">Create Account</a></li>
<li><a href="#"><span class="glyphicon glyphicon-shopping-cart"></span>Cart</a></li>
</ul>
</div>
</div>
</div><!--/.container-->
</div><!--/.top-bar-->
CSS
#header .search{
display: inline-block;
}
.navbar>.container .navbar-brand{
margin-left: 0;
}
.top-bar {
padding: 10px 0;
background: #191919;
border-bottom: 1px solid #222;
line-height: 28px;
}
.search-form .form-group {
float: right !important;
transition: all 0.35s, border-radius 0s;
width: 32px;
height: 32px;
background-color: #fff;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
border-radius: 25px;
border: 1px solid #ccc;
}
.search-form .form-group input.form-control {
padding-right: 20px;
border: 0 none;
background: transparent;
box-shadow: none;
display:block;
}
.search-form .form-group input.form-control::-webkit-input-placeholder {
display: none;
}
.search-form .form-group input.form-control:-moz-placeholder {
/* Firefox 18- */
display: none;
}
.search-form .form-group input.form-control::-moz-placeholder {
/* Firefox 19+ */
display: none;
}
.search-form .form-group input.form-control:-ms-input-placeholder {
display: none;
}
.search-form .form-group:hover,
.search-form .form-group.hover {
width: 100%;
border-radius: 4px 25px 25px 4px;
}
.search-form .form-group span.form-control-feedback {
position: absolute;
top: -1px;
right: -2px;
z-index: 2;
display: block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center;
color: #3596e0;
left: initial;
font-size: 14px;
}
這裏是jsfiddle
是否將您的搜索表單放入'ul'中? – Gael
我不認爲這是可能的。在UL LI我們不能添加DIV類我猜 – user1120133
http://stackoverflow.com/a/18269134/1064270 – Gael