A user wants to enable horizontal scrolling for a subcategory button section on mobile devices for their collection page. Currently, the element is hidden on mobile with display: none in a media query.
Current Setup:
Desktop shows a flex container with subcategory links (Treatment Couches, Hydraulic Couches, etc.)
Mobile hides this section entirely via CSS media query at max-width 1330px
The code includes conditional logic to display buttons for specific collection handles
Goal:
Make the subcategory navigation visible on mobile with horizontal scroll functionality instead of hiding it.
Status:
No responses yet. The user is seeking CSS guidance to implement mobile horizontal scrolling while maintaining the existing desktop layout.
Summarized with AI on November 12.
AI used: claude-sonnet-4-5-20250929.
We have a subcategory button section on our collection page:
I want this to appear on mobile, with a horizontal scroll. Currently it is set to display: none. What css do I need to achieve this?
{% if collection.handle == ‘treatment-couches’
or collection.handle == ‘hydraulic-couches’
or collection.handle == ‘examination-couches’
or collection.handle == ‘electric-couches’
or collection.handle ==‘blue-treatment-couches’
or collection.handle ==‘black-treatment-couches’
or collection.handle ==‘white-treatment-couches’
or collection.handle ==‘1-section-massage-beds’
or collection.handle ==‘2-section-treatment-couches’
or collection.handle ==‘3-section-treatment-couches’
or collection.handle ==‘5-section-massage-beds’
or collection.handle ==‘beauty-couches’
or collection.handle ==‘massage-beds’
or collection.handle ==‘neurology-couches’
or collection.handle ==‘physiotherapy-beds’
or collection.handle ==‘podiatry-couches’
or collection.handle ==‘tatoo-couches’
or collection.handle ==‘addax-treatment-couches’
or collection.handle ==‘plinth-medical-treatment-couches’
or collection.handle ==‘avalon-treatment-couches’
or collection.handle == ‘treatment-couch-upholstery’
%}
Updated code block. You should replace your entire existing block from {% if collection.handle … to {% endif %} with this new one.
{% if collection.handle == ‘treatment-couches’
or collection.handle == ‘hydraulic-couches’
or collection.handle == ‘examination-couches’
or collection.handle == ‘electric-couches’
or collection.handle ==‘blue-treatment-couches’
or collection.handle ==‘black-treatment-couches’
or collection.handle ==‘white-treatment-couches’
or collection.handle ==‘1-section-massage-beds’
or collection.handle ==‘2-section-treatment-couches’
or collection.handle ==‘3-section-treatment-couches’
or collection.handle ==‘5-section-massage-beds’
or collection.handle ==‘beauty-couches’
or collection.handle ==‘massage-beds’
or collection.handle ==‘neurology-couches’
or collection.handle ==‘physiotherapy-beds’
or collection.handle ==‘podiatry-couches’
or collection.handle ==‘tatoo-couches’
or collection.handle ==‘addax-treatment-couches’
or collection.handle ==‘plinth-medical-treatment-couches’
or collection.handle ==‘avalon-treatment-couches’
or collection.handle == ‘treatment-couch-upholstery’
%}
<style>
.treatment-subcats {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 20px;
}
.treatment-subcats a {
padding: 8px 12px;
border: 1px solid #dcdcdc;
border-radius: 4px;
text-decoration: none;
color: black;
font-size: 14px;
background: white;
font-family: Montserrat, sans-serif;
font-weight: 500;
line-height: 1.6;
cursor: pointer;
white-space: nowrap;
}
.treatment-subcats a:hover {
background-color: #f7f7f7;
}
@media only screen and (max-width: 768px) {
.treatment-subcats {
flex-wrap: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
padding-bottom: 10px;
}
.treatment-subcats::-webkit-scrollbar {
display: none;
}
}
</style>
<div class="treatment-subcats">
<a href="/collections/hydraulic-couches">Hydraulic Couches</a>
<a href="/collections/electric-couches">Electric Couches</a>
<a href="/collections/examination-couches">Examination Couches</a>
<a href="/collections/massage-beds">Massage Beds</a>
<a href="/collections/treatment-couch-accessories">Treatment Couch Accessories</a>
</div>
{% endif %}
After saving the changes, view one of your specified collection pages on a mobile device. The subcategory buttons should now appear in a clean, scrollable horizontal row.
To show the subcategory buttons on mobile and make them scroll horizontally, you just need to replace the display: none with a horizontal scroll layout.
You can use something like this:
@media only screen and (max-width: 768px) {
.treatment-subcats {
display: flex;
flex-wrap: nowrap;
overflow-x: auto;
gap: 10px;
-webkit-overflow-scrolling: touch;
}
.treatment-subcats a {
flex: 0 0 auto;
}
}
This keeps all the buttons in one row and allows side-to-side scrolling on mobile.
If you’re using a specific theme, let me know—can fine-tune it if needed.