搜索框中无法显示搜索图标

时间:2014-05-09 12:37:29

标签: html css twitter-bootstrap-3 search-box

我想在搜索框中有一个可点击的搜索图标,但搜索框中没有显示图标。类图标搜索似乎不起作用。我使用bar而不是navbar来自定义其高度及其工作正常.Plus,我应该如何自定义搜索框的高度?

<div  class="bar navbar-inverse navbar-fixed-top">
   <div class="container">
            <span id="logo">  
                <a href="main.php">XYZ</a>
            </span>
            <span class="col-xs-5 right-inner-addon ">
    <i class="icon-search"></i>
    <input type="text" class="form-control" />
</span>
    </div>   
</div>

.right-inner-addon {
    padding-top: 6px;
    position: relative;
}
.right-inner-addon input {
    padding-right: 30px;    
}
.right-inner-addon i {
    position: absolute;
    right: 0px;
    padding: 10px 6px;
    pointer-events: none;
}

.bar{
    min-width: 800px;
    background-color: #563d7c;  
    width:100%; 
    height:43px;    
    box-shadow: 0px 3px 25px #888888;
    position: fixed;
}

1 个答案:

答案 0 :(得分:0)

如果您使用的是Bootstrap 3,可以尝试使用以下代码:http://jsfiddle.net/D2RLR/5888/

<div  class="bar navbar-inverse navbar-fixed-top">
    <div class="container">
        <span id="logo">  
            <a href="main.php">XYZ</a>
        </span>
        <span class="col-xs-5 right-inner-addon ">
            <div class="input-group">
                <input type="text" name="search" id="search" class="form-control" placeholder="Test" />
                <span class="input-group-addon" for="search">
                    <i class="glyphicon glyphicon-search"></i>
                </span>
            </div>
        </span>
    </div>   
</div>