All things Shopify and commerce
Hello All,
I am new to Shopify and have recently created my store. However, I am encountering an issue where the header background color appears white when viewed on a desktop and black when viewed on a mobile device. I attempted to resolve this by applying the following code to Assets --> base.css, but the problem persists.
@media only screen and (max-width: 989px){
.header-wrapper.color-background-1.gradient {
background: white;
}
.header-wrapper.color-background-1.gradient * {
color: white;
}
div#shopify-section-sections--21453125976343__header {
margin-bottom: 0px;
}
}
Desktop Header
Mobile Header
Regards
I applied your solution, but issue still persist.
Regards
Hello @AlokBeheria
you replace your code to this code
.header-wrapper.color-background-1.gradient {
background: white;
}
@media only screen and (max-width: 989px) {
.header-wrapper.color-background-1.gradient {
background: white;
}
.header-wrapper.color-background-1.gradient * {
color: black;
}
div#shopify-section-sections--21453125976343__header {
margin-bottom: 0px;
}
}
Buy me a Pizza
- If helpful then please Like and Accept Solution.
Thanks
After applying and save it , it refused to work.
Regards
A
Hi @AlokBeheria
Here’s a more structured approach:
Define the CSS for desktop and mobile separately.
Ensure selectors are correctly targeting the elements.
Check for other conflicting styles.
Here’s an improved version of your CSS code:
- Go to Online Store -> Theme -> Edit code.
- Find the file assets/base.css and paste the code below at the bottom of the file.
.header-wrapper.color-background-1.gradient {
background: white;
}
.header-wrapper.color-background-1.gradient * {
color: black; /* Assuming you want text color to be black on desktop */
}
@media only screen and (max-width: 989px) {
.header-wrapper.color-background-1.gradient {
background: black;
}
.header-wrapper.color-background-1.gradient * {
color: white;
}
div#shopify-section-sections--21453125976343__header {
margin-bottom: 0px;
}
}
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024