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.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024