默认情况下,背景显示为白色。是否可以通过任何方式将其背景颜色更改为透明..?
<script>
(function() {
var cx = '005519348941191855053:d0uziw7c2dq';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
答案 0 :(得分:1)
如果你想让容器透明。您可以随时检查Google脚本的输出,并通过CSS添加自定义。您可以使用.gsc-control-cse
!important
body {
background:#f44336;
}
.gsc-control-cse {
background:transparent !important; /* enforce this rule; do not allow override */
border-color:transparent !important; /* border color */
}
&#13;
<script>
(function() {
var cx = '005519348941191855053:d0uziw7c2dq';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
&#13;