I have a button that I need to be visible on mobile but not on desktop.
(Ideally it would be great if this button could also be apart of the header section so I don’t have to duplicate it on every page).
Website: https://f7b6e0-f9.myshopify.com/
A user needed to display a “Book now” button exclusively on mobile devices while hiding it on desktop, preferably within the header to avoid duplicating it across pages.
Solution provided:
header.liquid file (before </header> closing tag)base.css to hide the button on desktop screens (min-width: 900px).book-now-button to target the elementFollow-up issue resolved:
The user requested additional padding below the button on mobile because it was touching the image underneath. This was fixed by adding padding-bottom: 15px to the .book-now-button class in the CSS.
Status: Resolved successfully. The user confirmed both solutions worked as intended.
I have a button that I need to be visible on mobile but not on desktop.
(Ideally it would be great if this button could also be apart of the header section so I don’t have to duplicate it on every page).
Website: https://f7b6e0-f9.myshopify.com/
Hello @britt2lee
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 of the file.
@media only screen and (max-width: 767px) {
.isolate {
display: none;
}
}
@britt2lee Please follow below steps to hide "Book now " button on desktop and add that button in header to avoid duplicating the button on every page. Let me know whether it is helpful for you.
[Book now](https://www.tanglezhairstudio.co.nz/)
@media screen and (min-width: 990px) {
.book-now-button {
display: none;
}
}
Now, the “Book now” button displayed on all page only for mobile.
Result will be like,
Desktop:
Mobile:
Please provide your support by click “Like” and “Accepted” if our solution works for you. Thanks for your support.
Hello @britt2lee
If the above code not working please try this code -
Go to the Online Store->Theme->Edit code->Assets->base.css> add this code at the bottom of the file.
@media only screen and (max-width: 767px) {
.rich-text__wrapper.rich-text__wrapper--center a {
display: none;
}
}
Thank you so much! This worked great ![]()
Can you please also show me how to add padding under the button for mobile, as it touches the image underneath it at the moment.
@britt2lee By following the steps shared in previous comment, go to “base.css” file and paste the below code at the bottom of the file to add padding under the button for mobile. Let me know whether it is helpful for you.
.book-now-button {
padding-bottom: 15px;
}
NOTE: You can change the px value to increase or decrease the padding.
Result will be like,
Please provide your support by click “Like” and “Accepted” if our solution works for you. Thanks for your support.
That worked great! Thanks ![]()