How do we change the search box image?
Question
We want to change the look of the search box, specifically the image.
CSS won't work. We have a regular publishing site in SP2010 and we're modifying the master page v4.master
.
The current image source is coming from sharepoint: /_layouts/images/gosearchrtl15.png
Any ideas?
Solution
If you look in the MasterPage
you will see that there is a DelegateControl
called SmallSearchInputBox
.
DelegateControls let you swap out controls for controls defined in features at a web/site/application/farm level. For more details see the linked blog post, it's Targetted at SP2007, but the concept is the same in 2010.
http://blogs.msdn.com/b/pavankumar/archive/2009/03/24/customizing-small-search-box.aspx
You can also copy this file into your own feature as a starting point.
<SharePointHive>\14\TEMPLATE\FEATURES\OSearchBasicFeature\SearchArea.xml
Simply change the two properties for "GoImageUrl
" and "GoImageUrlActive
" (and optionally the RTL versions of them)
OTHER TIPS
I typically use css to cancel out the existing image, then put my own image as a background. I wrote up my normal process for styling/skinning the SharePoint 2010 (MOSS) Search Box. It might be useful to anyone reading this article looking for a walkthrough. Skin/Style the SharePoint 2010 OOB Search Control - Labs.steveottenad.com.
If it is set in the control definition, and not in the CSS which sometimes happens, you can either replace the image (bad idea) or put some simple code in the masterpage to swap out the image after the page renders.
I wrote an article for a while about creating a design for SharePoint 2010 search boxes at MSDN, hopes this could helps: http://msdn.microsoft.com/en-us/library/hh528515.aspx#CreatingDesignForSP2010GlobalNavAndSearch_AboutTheAuthor
/ Christian