Jump to content

How do I center the content in a cropped code block

Recommended Posts


I have used a code block to contain an image and have created some code to allow this code block to crop relative to the page dimensions. I am however unsure how to keep the content centered vertically rather than cropping from the top.

Here is an example of my current css

.sqs-block { 
  padding: -0 !important;
  margin-top: -0px;
  margin-bottom: -0px;
  object-fit: cover;
  max-height: 50vh;

Many thanks

Link to comment
  • Replies 1
  • Views 274
  • Created
  • Last Reply


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.