【发布时间】:2013-11-20 17:51:27
【问题描述】:
我在设置Google Custom Search 框的样式(不是结果)方面需要帮助
旧样式使用form 标签,您可以在其中轻松设置搜索框的外观和风格。
<form action="/search" id="searchbox_abc:123" class="search">
<input type="hidden" name="cx" value="abc:12">
<input type="hidden" name="cof" value="FORID:XX">
<input type="text" name="q" size="16" class="smalltext">
<input type="submit" name="sa" value="SEARCH" class="smalltext">
</form>
使用新的 CSEv2 代码,它包含在脚本标签中:
<script>
(function() {
var cx = 'abc:123';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
并且您必须将以下标签放在您希望显示搜索框的位置。
<gcse:search></gcse:search>
我需要有关如何将新的 CSE 设置为看起来像以前的样式的帮助。 (字体大小、按钮和输入字段大小..等,样式与之前完全相同..应用类/设置字体..等)
谢谢!
【问题讨论】: