Shopify themes, liquid, logos, and UX
Hi there,
I am trying to modify the image banner button size in the Dawn theme, but only for mobile. On mobile, the button is too large.
In section-banner-css I was able to modify the button/size padding entirely using the following code at the bottom:
}
.banner .banner__buttons .button{
padding: 4px 8px;
}
However, I require the padding to be different for mobile than it is for desktop.
Cheers!
Krista
Solved! Go to the solution
This is an accepted solution.
This is Kate from PageFly - Landing page builder, I’d like to suggest this idea:
You can use CSS media queries to target specific screen sizes and apply different styles for different devices. Here's an example:
@media (max-width: 767px) {
.banner .banner__buttons .button {
padding: 2px 4px;
}
}
.banner .banner__buttons .button{
padding: 4px 8px;
}
The media query @media (max-width: 767px)
targets screens with a maximum width of 767px, which is commonly used as the breakpoint for mobile devices. The styles inside the media query will only be applied on mobile devices with a screen width less than or equal to 767px. The styles outside the media query will be applied on all other devices.
Hope my answer will help you.
Please let me know if it works by giving it a Like or marking it as a solution!
PageFly - #1 Page Builder for Shopify merchants.
All features are available from Free plan. Live Chat Support is available 24/7.
@media screen and (max-width: 750px){
// mobile css here
}
You can put your mobile style inside this media query! Then put this code inside base.css!
Hi
This is Victor from PageFly - Shopify Page Builder App
Please add this code to your theme.liquid above the </head> to get this solved
Step 1: Online Stores > Themes > More Actions > Edit code
Step 2: click on theme.liquid and paste the code above the </head>
<style>
@media screen and (max-width: 767px){
.banner .banner__buttons .button{
padding: 4px 8px;
}
}
</style>
Hope this can help you solve the issue
Best regards,
Victor | PageFly
share the store url ?
Hi @kmacgillivray
I hope you are doing good and welcome to the Shopify Community!
I am Santanu from MS Web Designer (Top Rated Shopify Certified Experts and eCommerce Consultant from Singapore).
Can you pls share your store URL with me, so i can check it once in my device and find the exact solution as per your theme layout.
Regards,
Santanu
If it’s helpful to you, please mark it as a solution.
Need Help with Shopify Design, Migration, Speed, or Custom tasks?
email: hi@mswebdesigner.com
Try Our Conversion Booster app to get more sales | Connect Our Founder Linkedin
This is an accepted solution.
This is Kate from PageFly - Landing page builder, I’d like to suggest this idea:
You can use CSS media queries to target specific screen sizes and apply different styles for different devices. Here's an example:
@media (max-width: 767px) {
.banner .banner__buttons .button {
padding: 2px 4px;
}
}
.banner .banner__buttons .button{
padding: 4px 8px;
}
The media query @media (max-width: 767px)
targets screens with a maximum width of 767px, which is commonly used as the breakpoint for mobile devices. The styles inside the media query will only be applied on mobile devices with a screen width less than or equal to 767px. The styles outside the media query will be applied on all other devices.
Hope my answer will help you.
Please let me know if it works by giving it a Like or marking it as a solution!
PageFly - #1 Page Builder for Shopify merchants.
All features are available from Free plan. Live Chat Support is available 24/7.
Thank you -- appreciate the thorough explanation as someone new to CSS! I was able to resolve this with some of your code, although I use the max width to do the following to get it to work:
@media (min-width: 768px) {
.banner .banner__buttons .button{
padding: 30px 50px;
top: 20px;
right: 5px;
}
}
It doesn't seem to wanna work on mobile when I use:
@media (max-width: 767px) { .banner .banner__buttons .button { padding: 2px 4px; } }
It sounds like you're on the right track! It's possible that there are other styles conflicting with your media query. Make sure to include your media query styles after any styles that they might be conflicting with, and to use specific selectors. Additionally, you may want to use the !important
rule in your media query styles to ensure that they take precedence over other styles:
@media (max-width: 767px) {
.banner .banner__buttons .button {
padding: 2px 4px !important;
}
}
@media (min-width: 768px) {
.banner .banner__buttons .button {
padding: 30px 50px;
top: 20px;
right: 5px;
}
}
If that still doesn't resolve the issue, you may want to try using developer tools in your browser to inspect the element and see what styles are being applied to it.
Please let me know if it works by giving it a Like or marking it as a solution!
PageFly - #1 Page Builder for Shopify merchants.
All features are available from Free plan. Live Chat Support is available 24/7.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024