【问题标题】:Search Bar with background graphics带有背景图形的搜索栏
【发布时间】:2013-05-27 09:01:06
【问题描述】:

我有一个如下所示的搜索框,我正在使用引导程序来提供灵活的布局。如何使用像下面这样的设计并确保我可以获得可拉伸的搜索框。

【问题讨论】:

  • 向我们展示您的代码“搜索框”

标签: html css search


【解决方案1】:

您需要一个容器来放入您的输入框,并在其中放置一个前端和结束 div。根据浏览器的兼容性,您可能需要添加更多 div,以确保您的输入框在 IEX7/8 等浏览器中正确显示。

所以你会得到以下内容:

<form class="searchbox">
  <input type="text" class="text" />
  <input type="submit" class="submit" />
</form>

伴随着下面的例子CSS

form.searchbox { background:url(leftside_image.gif) 0 0 no-repeat; padding-left:15px; }
form.searchbox input.text { border:none; border-top:1px solid #999; border-bottom:1px solid #999; height:25px; line-height:25px; padding:0 5px; }
form.searchbox input.submit { background:url(rightside_image.gif); }

【讨论】:

    【解决方案2】:

    像这样添加你的 Html 部分

    <div class="searchbox">
       <input class="lightsearch" type="text" name="s" onfocus="doClear(this)" value="">
    </div>
    

    css部分,下载一个搜索框图片并替换为名称

    .searchbox input.lightsearch {
        background: url("images/lightsearch.png") no-repeat scroll 0 0 transparent;
        border: 0 none;
        color: #575757;
        font-size: 11px;
        height: 19px;
        margin-top: 24px;
        padding: 2px 5px 2px 24px;
        width: 170px;
    }
    

    【讨论】:

      猜你喜欢
      • 2011-07-10
      • 2018-02-22
      • 2012-11-05
      • 1970-01-01
      • 2014-06-06
      • 2013-10-10
      • 2013-11-01
      • 2015-01-16
      • 1970-01-01
      相关资源
      最近更新 更多