Search Bar in Global Header

I’ve really struggled to implement a search bar to the global header. While I am able to simply add the search module to the global header, it keeps the formatting for .forms.

I can certainly change those properties to make the header look good, but then all the forms on the site are also changed.

Does anyone have any solutions? I’ve tried adding a new .search-form to the .css and updating the code in the site search module but ultimately its been a big waste of time.

Hey @kalex
The default HS site search module will have the follwoing html/css structure:

  • .hs-search-field__bar
    • .hs-search-field__input

You should be able to override those target the search input fields!
Hope this gets you going!

Search Bar in Global Header

Hello @kalex
You can use the code in the global header. The code I am giving you will help you. Below code

<!-- Search Box code start --><!-- HTML to show when checked --><div class="search-item-main"><div id="btn-search" class="search-icon" ><i class="fa fa-search"></i></div></div><div class="search"><button id="btn-search-close" class="btn btn--search-close" aria-label="Close search form"><i class="fa fa-times"></i></button><form class="search__form" action="/{{ site_settings.content_search_results_page_path }}"><input class="search__input" name="term" type="search" placeholder="Search here" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /><span class="search__info">Hit enter to search or ESC to close</span></form></div>

Thank you!

Anytime :+1: