Change search bar

Topic summary

Goal: Adjust Shopify search bar so the search icon appears on the right and the close (“X”) sits outside the search field on mylongevitylife.com.

Proposed solutions:

  • Theme.liquid edit: One reply advised adding custom code under the tag in theme.liquid. However, the actual snippet wasn’t included in the post (only a screenshot reference), so exact instructions are unclear.
  • CSS in Assets > base.css (option 1):
    • .search__button.field__button { right: 0 !important; left: inherit !important; }
    • .modal__close-button.link { position: absolute !important; right: 0 !important; left: inherit !important; }
    This repositions the search icon to the right and the modal close button to the outer right.
  • CSS in Assets > base.css (option 2):
    • button.search__button.field__button { right: 0; left: auto; }
    • .modal__close-button .icon { margin-left: 30px; }
    Includes step-by-step file location guidance.

Notes: “search__button” is the search icon button; “modal__close-button” is the search modal’s close icon. Screenshots were referenced for context.

Status: No confirmation from the original poster; outcome unresolved.

Summarized with AI on December 27. AI used: gpt-5.

Hello everyone,

I would like to adjust the design of the search bar.

It looks currently like this:

Which code snippet do I have to add where so that the search icon is on the right side and the cross is outside of the search bar?

Link to the website: https://mylongevitylife.com/

Thank you!

1 Like

Hey @Lara14 ,

Go to your theme’s “Edit Code” Option, then in the search bar type “theme.liquid”
Below the tag “” tag paste the following. Screenshot attached for reference.


Screenshot is for reference only, the correct code to paste is the one shown above.

@Lara14

.search__button.field__button {
	right: 0 !important;
	left: inherit !important;
}
.modal__close-button.link {
	position: absolute !important;
	right: 0 !important;
	left: inherit !important;
}

please add this into your base.css file which is located in the theme files

Online Store > Edit code > Theme files > assets > base.css

Hi @Lara14

  1. In your Shopify Admin go to online store > themes > actions > edit code
  2. Find Asset > base.css and paste this at the bottom of the file:
button.search__button.field__button {
right: 0;
left: auto;
}
.modal__close-button .icon {
margin-left: 30px;
}