Custom Google Custom Search (GCS) Text And Styling

余生颓废 提交于 2020-02-08 09:49:24

问题


I have a paid/business version of the Google Custom Search, but I seems I can only customize small parts of the search.

Is there a way to:

  • Include the search without the default CSS? I don't want to override most styles with !important
  • Change the default text of the search-button and/or add a image to it without using own custom CSS

Idea is to have a simple styled input field with a magnifying glass next to it, both with white background and a gray border. Unfortunately it looks like google puts lots of margin/padding/other stuff on top which I do not want.


回答1:


I presume you are talking about styling the search box rather than the search results?

If so, you don't need to use their search box at all as long as you have a search result page which works off a parameter (e.g. www.example.com/searchresults/?q=searchquery) rather than a pop up. This is set up in GCS admin page under Look and Feel -> Layout -> Results only. Click "Save & Get Code" and then put the JavaScript code on this /searchresults/ page.

Then you can just have a standard form which directs to that page and passes the search query. This works for both the premium paid version and the free version.

This is how I have it set up on www.tunetheweb.com if you want to have a look.

Only downside is you can't get their auto complete suggestions in the search box if you use that feature as its no longer their search box.



来源:https://stackoverflow.com/questions/33735333/custom-google-custom-search-gcs-text-and-styling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!