Shopify themes, liquid, logos, and UX
- Whisper Theme
- Frequencywear.eu
I have created a custom Liquid to make my header Navigation a different Color than the Main Header. This though looks completely messed up on mobile, which is why i am trying to fix by making that specific liquid not apply for mobile.
the Liquid is assigned as a div via
<div class="headercolor"> [my custom liquid] </div>
I have tried the following:
Custom CSS + bottom of base.css:
@media screen and (max-width: 768px) {
.headercolor {
display: none;
}
}
Theme.liquid:
<style>
@media screen and (max-width: 768px) {
.headercolor {
display: none;
}
}
</<style>
this is on Desktop, all fine.
this is on mobile, very much messed up.
Solved! Go to the solution
This is an accepted solution.
Adding custom Liquid code to style your header color can be effective, but it’s similar to making edits in your theme.liquid file or adjusting the base.css file. However, editing base.css is generally the better approach as it keeps your custom styles centralized and easier to manage.
Here’s how to proceed:
1. Remove existing custom code in <div class="headercolor"> and theme.liquid
2. Update the code in base.css
sticky-header.header-wrapper.gradient:after {
content: "";
background: #ab80da;
display: block;
width: 100%;
height: 50px;
margin-top: -50px;
}
sticky-header.header-wrapper.gradient {
position: relative;
}
.header__active-menu-item,.header__menu-item,span.header__active-menu-item {
color: black;
}
@media screen and (max-width: 768px) {
sticky-header.header-wrapper.gradient:after {
display: none;
}
}
PLease, share your store URL. Thanks!
This is an accepted solution.
Adding custom Liquid code to style your header color can be effective, but it’s similar to making edits in your theme.liquid file or adjusting the base.css file. However, editing base.css is generally the better approach as it keeps your custom styles centralized and easier to manage.
Here’s how to proceed:
1. Remove existing custom code in <div class="headercolor"> and theme.liquid
2. Update the code in base.css
sticky-header.header-wrapper.gradient:after {
content: "";
background: #ab80da;
display: block;
width: 100%;
height: 50px;
margin-top: -50px;
}
sticky-header.header-wrapper.gradient {
position: relative;
}
.header__active-menu-item,.header__menu-item,span.header__active-menu-item {
color: black;
}
@media screen and (max-width: 768px) {
sticky-header.header-wrapper.gradient:after {
display: none;
}
}
It worked, thank you a lot!
Hi @FrequencyWear
Please try replacing headercolor custom liquid with this
<div class="headercolor">
<style>
@media (min-width: 769px){
sticky-header.header-wrapper.gradient:after {
content: "";
background: #ab80da;
display: block;
width: 100%;
height: 50px;
margin-top: -50px;
}
sticky-header.header-wrapper.gradient {
position: relative;
}
.header__active-menu-item,.header__menu-item,span.header__active-menu-item {
color: black;
}
}
</style>
</div>
Thanks!
This worked too, thank you very much!
Unfortunately i can only mark one reply as solution though.
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