3

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?

2
  • what do you mean "css won't work"?
    – user298
    Sep 27, 2010 at 13:56
  • because the image is specified in the definition of image, ie: <img src="images/img.gif"> and the src tag cant's be modified using css Sep 28, 2010 at 6:49

4 Answers 4

4

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.

Link

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)

3
  • I just need to change the icon of the search box... there should be a much simpler way.. I mean do I have to implement a feature just to change the image!! Sep 28, 2010 at 6:57
  • I know, if feels like there should be an easier way, but unfortunately your other options are all a bit hacky.
    – Neil White
    Sep 28, 2010 at 9:47
  • you're right, implementing a feature was the best/easiest way Sep 28, 2010 at 14:15
3

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.

1

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.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.