dont hide search bar in desktop view
hide search bar in mobile view and only display the search icon
please help how to do this
A user seeks to implement responsive search functionality where:
Desktop view: Search bar remains visible and functional
Mobile view: Search bar is hidden, only the search icon displays
Two solutions were provided:
PageFly-Victor’s approach: Add custom code to the theme.liquid file before the closing </body> tag. After clarification about the requirements, Victor offered a revised code snippet.
oscprofessional’s solution: Insert CSS code into the base.css file (Online Store → Theme → Edit code → Assets → base.css) using a media query targeting screens 750px and wider. The CSS hides the search field label and modal elements while styling the search button.
Both solutions involve adding custom code to the Shopify theme files. The discussion includes screenshots demonstrating the desired outcome, though some text in the thread appears corrupted or reversed.
dont hide search bar in desktop view
hide search bar in mobile view and only display the search icon
please help how to do this
Hi @niceeee
You can try this code by following these steps:
Go to Online store => themes => actions => edit code and add this code on file theme.liquid before tag
Hope this answer helps.
Best regards,
Victor | PageFly
I mean sir, in desktop view the search bar will remain but in mobile view it is hide and only search icon is displayed
Hi @niceeee , Sorry you can try this code
Hello @niceeee
You can try this code: it will be helpful to you
Go to the Online Store->Theme->Edit code->Assets->base.css>Add this code at the bottom.
@media screen and (min-width: 750px){
input#Search-In-Modal {
display: none !important;
}
.search label.field__label {
display: none !important;
}
.search__button .icon {
color: #fff !important;
}
.search__button {
top: -15px !important;
}
}