如何使Google自定义搜索白色背景透明?

问题描述 投票:0回答:1

这是到目前为止的代码。我想使白色边缘(背景)透明。 background-color:transparent !important;不起作用。请帮忙。谢谢

<style>
.container {
position: relative; 
width: 49%;
top: -11px;
float: right;
background-color:transparent !important;
}
</style>
<script async src="https://cse.google.com/cse.js?cx=xxxxxxhidenxxxxxxxxx"></script>
<div class="container">
<div class="gcse-search">
</div>
</div>

输出here

编辑:刚刚意识到白色边缘来自填充13。请根据我的代码帮助我如何删除填充13。非常感谢

html google-custom-search
1个回答
0
投票

您应该将css直接应用于cse元素。 cse脚本将在同一个父元素内创建一个div,其id类似于或等于"___gcse_0"。检查生成的html。我自己没有尝试过,但是应该在.gsc-control-cse而不是.container上使用CSS规则。否则,您只需要使用开发人员工具进行挖掘,找出具有白色背景的元素。

© www.soinside.com 2019 - 2024. All rights reserved.