Jump to content

[Share] Portfolio Page custom aspect ratio

Recommended Posts

Posted

You can use this CSS code to change Portfolio Page to custom ratio.

#1. Change aspect ratio on One Page

First, you need to find Portfolio Page ID.

In my example, it is: #collection-66a1bfc99041e47b896c1e48

image.png.57168e613f6e64a19e573768ec5020db.png

Next, use this CSS code

#collection-66a1bfc99041e47b896c1e48 div.grid-image {
    padding-bottom: 75% !important;
}

image.png.61c5edf7c3541fb14c423f7f07c76d91.png

If code run on Desktop Only, use this CSS code

@media screen and (min-width:768px) {
  #collection-66a1bfc99041e47b896c1e48 div.grid-image {
      padding-bottom: 75% !important;
  }
}

image.png.b5114752b0172bb315b449641e6c1b19.png

If code run on Mobile only

@media screen and (max-width:767px) {
  #collection-66a1bfc99041e47b896c1e48 div.grid-image {
      padding-bottom: 75% !important;
  }
}

image.png.35058d916cee4f4505195cd51cb65572.png

#2. Change aspect ratio of 1 item
First, you need to find item url.
In my example, it is: /work-02/project-one-ephnc-hjaz3

image.thumb.png.8566c959a4de0213eb4546be8e813485.png

Next, use this code to Custom CSS box

a.grid-item[href="/work-02/project-one-ephnc-hjaz3"] div.grid-image {
    padding-bottom: 75% !important;
}

image.png.4f2946414ab182b9ddc76a655954aa51.png

If you want code affect on desktop only, use this new code

@media screen and (min-width:768px) {
   a.grid-item[href="/work-02/project-one-ephnc-hjaz3"] div.grid-image {
      padding-bottom: 75% !important;
  } 
}

image.png.e21535e2d331885aa72edf984edf0cd5.png

If code runs on Mobile Only, use this CSS

@media screen and (max-width:767px) {
   a.grid-item[href="/work-02/project-one-ephnc-hjaz3"] div.grid-image {
      padding-bottom: 75% !important;
  } 
}

image.png.af3c4a1c1222481957fecdeb1af8c953.png

#3. All Pages - Mobile Only

To change aspect ratio on Mobile Only, you can use this CSS

@media screen and (max-width:767px) {
  div.grid-image {
      padding-bottom: 75% !important;
  }
}

image.png.233cd51588b0ec7aab5da14be1b93e9c.png

#4. All Pages - Desktop Only
To change aspect ratio on Desktop Only, use this CSS

@media screen and (min-width:768px) {
  div.grid-image {
      padding-bottom: 75% !important;
  }
}

image.png.ba3cdfc87574953b1bba750c0d05e8a3.png

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!)

  • Replies 0
  • Views 38
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • 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.