css - 如何使用 bootstrap 创建类似 google 的下拉搜索框

标签 css twitter-bootstrap

我正在使用 twitter bootstrap,并且想在搜索框上创建一个下拉菜单。我正在尝试模拟 gmail 的搜索栏,其中输入搜索框末尾有一个插入符号,可以单击它来打开表单。

当单击插入符号时,我尝试使用 bootstrap 的下拉列表来显示 div。但是我无法像谷歌那样将插入符号放在输入框中。

查看谷歌的代码,我发现他们有一个没有边框的输入框,放置在下拉插入符号旁边,嵌入在带边框的 div 中。

我无法覆盖 Bootstrap 输入框的边框属性。有人试过吗?

下面是我的代码 -

<div class="input-append dropdown">

  <input type="text" name="puesto" class="input-xlarge noBorder"   placeholder="Email Address"/>    <a class="dropdown-toggle btn" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
    <b class="caret"></b>   </a>

  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">    Hello world   </ul>   <button class="btn" type="button"><i class="icon-filter"></i></button> </div> 

<style type="text/css">   .noBorder {border-top-width: 0px;} </style>

最佳答案

使用类来帮助覆盖,例如:

<input class="the-input" type="text" />

然后去掉那个边框:

input.the-input {
    border: none transparent;
    -webkit-box-shadow: none;
            box-shadow: none;
    filter:-;    /* for IE */
}

关于css - 如何使用 bootstrap 创建类似 google 的下拉搜索框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12513149/

相关文章:

html - 制作下拉菜单

html - 页面灰色滚动条且不滚动

html - 加速 DOM 树的渲染

javascript - 在 Bootstrap 模式中打开 map

html - 以 Bootstrap 水平形式并排放置下拉菜单和复选框

html - Bootstrap,全屏网站 : scrollbar on a div

css - 如何获取图像的高度并将该高度应用于 div?

html - 如何让图像填满整个容器?

javascript - 如何使用 select2 和 x-editable 格式化标签

html - 我怎样才能删除这个间距?