Google自定义搜索在Foundation 3中显示问题

时间:2013-01-12 18:07:41

标签: html css responsive-design zurb-foundation google-custom-search

我正在尝试添加Google自定义搜索,但它仍然显示不正确。按钮上的搜索图标丢失,看起来好像文本框的底部被切断了。

新会员,所以我无法发布图片。

代码

<div id="header">
  <div class="row">
    <div class="four columns">
      <h1><img src="images/QEFLogo.JPG" /></h1>
    </div>
    <div class="four offset-by-two columns">
      <div id="iso" class="hide-for-small">
        <h1>
          <img src="images/ISO9001.jpg" />
          <img src="images/ISO14001.jpg" />
        </h1>
      </div>
      <div id="gcsearch" class="hide-for-small">
        <gcse:searchbox-only></gcse:searchbox-only>
      </div>
    </div>
  </div>
</div>

没有真正的CSS可以说......

#gcsearch {
    width:300px;
    position:relative;
    left:-5px;
}

该脚本不受Google生成的代码的影响。

编辑现在发现这是问题所在。 Google元素在其服务器上使用CSS文件default.css。这会产生宽度和高度。

在CSS表的第126行,它定义了......

.cse .gsc-search-button input.gsc-search-button-v2, 
input.gsc-search-button-v2 {
    height: 13px;
    margin-top: 2px;
    min-width: 13px;
    padding: 6px 27px;
    width: 13px;
}

请记住,我根本没有太多的Javascript知识,为什么会发生这种情况,我该如何解决?

我在非基础页面上测试了代码并正确呈现。

3 个答案:

答案 0 :(得分:4)

这是Foundation框架的一个问题。将以下内容添加到按钮并解决。所引用的类是由Google生成的,这就是为什么它们不会显示在我上面的代码中。

input.gsc-search-button, input.gsc-search-button:hover, input.gsc-search-button:focus {
background-image: inherit;
box-sizing: content-box;
}

答案 1 :(得分:1)

我现在有同样的问题。对于Google类的第2版,我添加了以下css

<style>
 .cse .gsc-search-button input.gsc-search-button-v2, input.gsc-search-button-v2 {
   background-image: inherit;
   box-sizing: content-box;
   -moz-box-sizing: content-box;
 }
</style>

现在可以在Chrome和Firefox中使用

答案 2 :(得分:0)

代码中有一个</div>个结尾标记太多了。这使得HTML无效,这可能是它显示错误的原因。