Shopify themes, liquid, logos, and UX
I am trying to add a CSS gradient overlay to the images in the media grid section of the Enterprise theme. Gradient should be behind the text.
Would be even better if this could be changed in the hover state.
Thanks in advance!
N
Solved! Go to the solution
This is an accepted solution.
Add this CSS in the "Custom CSS" area of in the settings of that section (adjust the gradient as needed):
.media--has-overlay::after {
background: linear-gradient(to right, rgba(0, 0, 0, 0.3), rgba(255, 0, 0, 0.3));
}
/* For Hover */
.media--has-overlay::after {
transition: opacity 0.3s ease;
opacity: 0;
background: linear-gradient(to right, rgba(0, 0, 0, 0.3), rgba(255, 0, 0, 0.3));
}
.gallery-block__image:hover .media--has-overlay::after {
opacity: 1;
}
This is an accepted solution.
Add this CSS in the "Custom CSS" area of in the settings of that section (adjust the gradient as needed):
.media--has-overlay::after {
background: linear-gradient(to right, rgba(0, 0, 0, 0.3), rgba(255, 0, 0, 0.3));
}
/* For Hover */
.media--has-overlay::after {
transition: opacity 0.3s ease;
opacity: 0;
background: linear-gradient(to right, rgba(0, 0, 0, 0.3), rgba(255, 0, 0, 0.3));
}
.gallery-block__image:hover .media--has-overlay::after {
opacity: 1;
}
Hi @Nick_S2
1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.css / based.css file and paste the code in the bottom of the file.
.media--has-overlay::before {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(to bottom, rgba(260, 302, 1, 0.6), rgba(220, 220, 440, 0)) !important;
z-index: 1;
transition: background 0.3s ease;
}
.block-media:hover .media--has-overlay::before {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.2)) !important;
}
.gallery-block__image-text {
position: relative !important;
z-index: 2 !important;
}
Result:
If my reply is helpful, kindly click like and mark it as an accepted solution.
Thanks!
Use our Big Bulk Discount app to boost your sales! 🚀 (https://apps.shopify.com/big-bulk-discount). Easy to set up and perfect for attracting more customers with bulk discounts. Try it now and watch your revenue grow!
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn 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, 2025