Jump to content

Mobile layout for image block.

Recommended Posts

  • Replies 5
  • Views 380
  • Created
  • Last Reply

Add to Design > Custom CSS

/* Products 2 columns */
@media screen and (max-width:767px) {
div#block-yui_3_17_2_1_1618893896866_14059 ~ .row .span-3 {
    width: 50% !important;
    float: left !important;
}
div#block-yui_3_17_2_1_1618893896866_14059 ~ .row .span-3:nth-child(2n+1) {
    clear: left !important;
}
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
5 hours ago, tuanphan said:

Add to Design > Custom CSS


/* Products 2 columns */
@media screen and (max-width:767px) {
div#block-yui_3_17_2_1_1618893896866_14059 ~ .row .span-3 {
    width: 50% !important;
    float: left !important;
}
div#block-yui_3_17_2_1_1618893896866_14059 ~ .row .span-3:nth-child(2n+1) {
    clear: left !important;
}
}

 

Thank you. 

Link to comment
On 5/2/2021 at 10:30 PM, kristobans said:

Hey @tuanphan.

 

How can I make that it works on multiple pages? 

https://modernbusiness.squarespace.com/categories/accessories

https://modernbusiness.squarespace.com/categories/toiletries

etc.

Basically, I have the same thing on numerous pages. 

Each page needs a different code. If you use Summary or Gallery block, we can target easier with 1 code

/* Mobile 2 columns products */
@media screen and (max-width:767px) {
/* accessories */
div#block-yui_3_17_2_1_1619418261951_140576+.row .span-3 {
    width: 50% !important;
    float: left !important;
}
div#block-yui_3_17_2_1_1619418261951_140576+.row .span-3:nth-child(2n+1) {
    clear: left !important;
}
/* toiletries */
div#block-yui_3_17_2_1_1619424383691_34796+.row .span-3 {
    width: 50% !important;
    float: left !important;
}
div#block-yui_3_17_2_1_1619424383691_34796+.row .span-3:nth-child(2n+1) {
    clear: left !important;
}
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
5 hours ago, tuanphan said:

Each page needs a different code. If you use Summary or Gallery block, we can target easier with 1 code


/* Mobile 2 columns products */
@media screen and (max-width:767px) {
/* accessories */
div#block-yui_3_17_2_1_1619418261951_140576+.row .span-3 {
    width: 50% !important;
    float: left !important;
}
div#block-yui_3_17_2_1_1619418261951_140576+.row .span-3:nth-child(2n+1) {
    clear: left !important;
}
/* toiletries */
div#block-yui_3_17_2_1_1619424383691_34796+.row .span-3 {
    width: 50% !important;
    float: left !important;
}
div#block-yui_3_17_2_1_1619424383691_34796+.row .span-3:nth-child(2n+1) {
    clear: left !important;
}
}

 

Hey. Thank you. I've changed the code for each page. It's easier at this point.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.