Shopify themes, liquid, logos, and UX
I used some code to change the search icon into a search bar in the Dawn Theme.
Does anyone know how to center and widen the search bar? (maybe another 50%)
Hi @PartyFair , kindly provide your store URL please and if it is password protected, please share the password as well. Thanks
Hi @PartyFair
1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.css / based.css file and paste the code in the bottom of the file.
.desktop-search {
padding-right: 130px;
}
.search__input.field__input {
padding-right: 33.8rem;
}
Result:
If my reply is helpful, kindly click like and mark it as an accepted solution.
If you are happy with my help, you can help me buy a COFFEE
Thanks!
Hello @PartyFair
Go to online store ----> themes ----> actions ----> edit code ---->base.css
add this code at the end of the file and save.
.search__input.field__input {
padding-right: 33.8rem !important;
}
Thanks
Thank you, that made it wider but not centered.
Go to online store ----> themes ----> actions ----> edit code ---->base.css
add this code at the end of the file and save.
.field {
width: 66%;
margin-right: 44rem !important;
}
result
If this was helpful, hit the like button and accept the solution.
Thanks
Almost there! I'd like it centered if possible. I tried changing some numbers in the code that you provided but it wasn't working for me.
you want to get it centered between logo and the login icon...??????
I'd like it in the center of the page
Go to online store ----> themes ----> actions ----> edit code ---->base.css
add this code at the end of the file and save.
Go to online store ----> themes ----> actions ----> edit code ---->base.css
add this code at the end of the file and save.
.header__icons {
padding-right: 6.8rem !important;
}
.search__input.field__input {
padding-right: 49.8rem !important;
}
.field {
width: 87%;
}
result
Thanks
Thanks so much for your help, but it seems to be not working properly and there's a glitch when using mobile. I appreciate your help, I think I'll leave it the way it is for now.
Hello PartyFair,
Please follow the below steps:
Access your theme editor:
/* Center the search bar */
.header__search {
display: flex;
justify-content: center;
align-items: center;
}
/* Adjust the width of the search bar */
.search-bar {
width: 150%; /* Increase width by 50% */
max-width: 600px; /* Optional: Set a max-width */
}
/* Adjust the input field styling (optional) */
.search-bar__input {
width: 100%; /* Ensure it uses the full width of the container */
padding: 0.5rem; /* Add padding for better appearance */
border: 1px solid #ccc; /* Optional: Add a border */
border-radius: 4px; /* Optional: Round corners */
}
Note: Take Backup/work in copy theme before putting this in live.
Thanks,
Thank you, I pasted it at the end of the base.css file and nothing happened unfortunately.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025