Using CSS, how would I make a particular block in a mosaic grid invisible on mobile view?
Topic summary
A user seeks to hide a specific block within a mosaic grid on mobile view using CSS, without affecting other blocks.
Initial Solutions Proposed:
- Use a media query targeting screens under 768px width with
display: noneapplied to the block’s CSS class or ID - Replace
.your-block-classwith the actual class/ID of the target block
Key Challenge:
- The block currently lacks a unique ID, making it difficult to target specifically
- User needs guidance on locating the block’s ID or class in the theme code
Recommended Approach:
- Add an ID to the image block in the theme.liquid file
- Apply CSS using
@media (max-width: 45em)withdisplay: nonetargeting the specific element - Paste the CSS code at the bottom of theme.css file in Assets
Current Status:
- A working CSS solution using nth-child selector was provided for the specific mosaic grid item
- User requested additional guidance on implementing the ID assignment in theme.liquid
- Discussion remains open with offer for direct assistance
Hi
- Go to online store → theme → edit code.
- Open theme.css
@media only screen and (max-width: 767px) {
.your-block-class {
display: none;
}
}
But does this make this one particular image invisible? (See my photo).
I do not want it to make all blocks invisible on mobileview.
Hi @JosenAndersen ,
Please send me the store link, I will check it for you
Actually, Your photo has not enough info for this. I need more info about parent component or class. Btw you can try like follow code.
@media only screen and (max-width: 767px) {
.mosaic-grid__item-image img {
display: none;
}
}
you can replace .your-block-class with the actual CSS class or ID of the block you want to hide.
Where do I find the ID of the block I want to hide?
There is no id at the moment. if you want to hide the image, at first, you should set id for the image block in them.liquid.
And then you follow my first reply. Thanks.
Hi @JosenAndersen ,
Please go to Actions > Edit code > Assets > theme.css file and paste this at the bottom of the file:
@media (max-width: 45em){
#shopify-section-template--19339290280273__mosaic_grid_xaKVBM .mosaic-grid__item:nth-child(2) {
display: none;
}
}
Is that something you can let me know how to do?
What code should I enter in theme.liquid?
Hi @JosenAndersen ,
If you have any questions, you can contact me directly.
Happy to help you ![]()

