Search code examples
htmlgoogle-custom-search

how to make google custom search white background transparent?


this is my code so far. i want to make white edge(background) transparent. background-color:transparent !important; does not work. please help. thanks

<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>

output here

Edited 1: just realized that white edge is from padding 13. please help me on how to remove padding 13 based on my code. thanks a lot


Solution

  • This issue is solved, complete code below:

    <style type="text/css">
    .googlesearch {
    position: relative; 
    width: 40%;
    float: right;
    top: 4px;
    margin-right: 5px;
    }
    .cse .gsc-control-cse, 
    .gsc-control-cse {
    padding: 0em;
    background: transparent;
    border: 0px;
    }
    </style>
    <script async src="https://cse.google.com/cse.js?cx=xxxxxxxxxxxxxxxxxxxxx></script>
    <div class="googlesearch">
        <div class="gcse-search"></div>
    </div>