
Can the Google AdSense Search Tool background be changed?Dave, how do I remove the "white" background color from the Google Adsense Search toolbar since it isn"t a gif or jpg picture as is your "Ask Dave" icon? Thanks! Digging around in the Google world, I've decided that you're talking about what Google calls the Adsense Search Box, not the Google Toolbar, because the latter has no relationship to the AdSense program, as far as I can tell. Which means that for this answer to have any meaning, you'll need to have already signed up for an AdSense account. But you probably should anyway, because even if it's just $20/month, you could be earning a few dollars from your Web site instead of always paying, paying, paying for hosting! Advertisement over. Let's get down to specific details! To get to the Google AdSense search box, you need to log in to AdSense, then click on "Search Settings", which will give you a pretty complex configuration form to fill out that includes "search box background color", though the only choices are white, black and gray. We can do better than that, however! Here's the default Google search box configured for my own account (which is kinda cool: if you search with it, then click on one of the resultant ads on the results page, I'll see a small % of the transaction.): There's a lot of code there to look at:
<!-- Search Google --> <center> <form method="get" action="http://www.google.com/custom" target="_top"> <table bgcolor="#cccccc"> <tr><td nowrap="nowrap" valign="top" align="left" height="32"> <a href="http://www.google.com/"> <img src="http://www.google.com/logos/Logo_25gry.gif" border="0" alt="Google" align="middle"></img></a> <input type="text" name="q" size="40" maxlength="255" value=""> </input> <input type="submit" name="sa" value="Search"></input> <input type="hidden" name="client" value="pub-7950118917489847"></input> <input type="hidden" name="forid" value="1"></input> <input type="hidden" name="channel" value="9514164789"></input> <input type="hidden" name="ie" value="ISO-8859-1"></input> <input type="hidden" name="oe" value="ISO-8859-1"></input> <input type="hidden" name="hl" value="en"></input> </td></tr></table> </form> </center> <!-- Search Google --> The key elements for what we want to tweak, however, are associated with the table that's used to wrap all the content. You can see it on line four: <table bgcolor='#cccccc'>. That sets our grey background. So, to change it to another color, simply replace the "#cccccc" with the RGB hex equivalent. If you need a cheat sheet, you might check out my Web Color Chart. In many, though not all, browsers, you can also change the color of buttons and input elements through use of Cascading Style Sheet inline specifications. Let's do something weird: let's make the background for the search box yellow, with a small red border (again, using CSS), have the button bright green and the background of the text input box itself pink. (Note: no actual colors were harmed in the production of this example. Don't try this at home. Professional color mixer.): If you don't see all the colors, then be thankful that your browser isn't fully CSS compliant. Just this once. If you're in a really up-to-date browser like FireFox, though, you'll see the world's most colorful search box. To accomplish the color changes, I changed the bgcolor attribute of the table tag and added three style= attributes to the appropriate HTML tags. Rather than duplicate all the code again, here are just the relevent few lines: <table bgcolor="#ffff99" style="border:4px double #900"> ... <input type="text" name="q" size="40" maxlength="255" value="" style="background-color:#fcf;"></input> <input type="submit" name="sa" value="Search" style="background-color:#6c3;"></input> By the way, let me kvetch about one thing: Google, there is no </input> tag. The input tag doesn't have a paired closing tag and if you want to be producing proper XHTML you should be using <input .... /> instead. Anyway, other than the frightening color scheme in this example, that should give you all the information you need to customize the Google search box for your own site!
Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon
Categorized:
Pay Per Click (PPC)
(Article 3871)
Tagged: Previous: What is Sarbanes Oxley and why does it change everything? Next: Where can I find the 'rev' utility for Solaris? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. You can also change the color of the outline of the Google image like so. I haven't tried any other colors but you get the idea. Posted by: Dave Taylor at February 8, 2005 11:02 PMJust wondering if anyone ever got penalized by google for editing their "google code" even if its just the background color. They mention this in their license agreement: Any AdSense ad code or search box code must be pasted directy into Web pages without modification. AdSense participants are not allowed to alter any portion of the ad code or change the layout, behaviour, or delivery of ads for any reason. It's impressive how a company that uses the slogan of "do no evil" can have browbeaten and intimidated the online community, isn't it Peter? I would have to say that I have never heard of Google complaining about people sending them traffic, and if they were going to be upset about changing the background color of a form on MY web site, well, that's not the Google i know and like... Posted by: Dave Taylor at June 6, 2005 8:14 PMDoes a search box, using the code as above, actually result in a search page with ads that make you money? You have an input element with forid=1, but I've found this to have no effect. You need FORID:1 in the "cof" input element (which also defines colours for the search results page). Without this, or with forid=0, you get a nicer search results page with the ads on the right instead of all across the top and bottom, BUT clicks don't seem to be credited through the adsense programme. Posted by: Jonathan at April 27, 2006 4:04 PMWell Dave, i am not agree with your answer to peter. As it is violating the license agreement, you can be banned anytime and the time u spent on doing this will be waste... It many the different questions that how much time google will take it to identifying it? Well, not much if u directly modify the google adsense code. Another trick that u can use is use CSS for search. Using CSS u can modify the google seach without touch the adsense code, that what i am doing for the site i m building currently. Posted by: John at May 24, 2007 3:25 AMI did not do this because I did not want to be banned but my text on my blog is white and I need it to be black so I will be trying to figure that out. Maybe some CSS to look over. Posted by: Ask Your PC at November 26, 2008 9:15 PMI have a custom goole search engine on my site, on the results page they are displayed with a choice of colour backgrounds, can i make this background clear, or no background colour and see the page colour instead?? is this possible as i hate having a flat colour behind my results and it disturbs the natural flow of the website. Many Thanks Hmmm...seems to me it would be better to make the style changes in your global CSS file. I'm sure this example was just to show it can be done, but for novices, learn to keep your CSS out of your HTML. That being said, this is a nice post dealing with a popular question. Well done. As for Google coming down on people for altering the look and feel of their search widget...no way! People at Google certainly have better things to do with their time. Posted by: Evercleanse at December 9, 2008 9:59 AMI have a lot to say, but ...
I do have a comment, now that you mention it!
|
![]()
Search
Find just the answers you seek from among our 2000+ free tech support articles by using our Lijit search engine.
Help!
Subscribe to
Ask Dave Taylor!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Industry News and Trade Shows Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|