Jump to content

Five: Make image block span full width like header

Recommended Posts

Hey everybody, hoping you can help. I want to design some images to span the entire width of the screen (like the headers already do on FIVE). However, I want them to appear in the body, but span past the side of the container width.

I put a stock image in place here: https://greencellfoam.squarespace.com/green-cell-coolers/ to show you the problem. The image block for the header obviously goes full and this one is limited to the page width.

Thanks for the help!

Link to comment
  • 2 years later...
  • Replies 4
  • Created
  • Last Reply

Long answer

Following Custom CSS example only works on one screensize


.image-block {
   width: 100vw;
   position: relative;
   left: -305px; /*changed depending on padding*/
   padding-left: 0 !important;
   padding-right: 0 !important;
}

If we were living 10 years ago before smartphones and our website only came in one width we could just use the code above.

The code makes the image full-width of the browser instead of using the width of any element on the page. The rest moves the gallery to the start from the left edge of the page.

Unfortunately the code above indeed only works for one screensize so you will need a combination of CSS and quite complex javascript that calculates the margins so it works on every template and regardless of what kind of custom CSS you're using. It must also take care of cross-browser issues and do new calculations if user resizes their browser. I've explained the logic

Short answer

You can get a (commercial) plugin that does everything automatically. Here's a link to the full-width image blocks plugin if you're interested.

Freelance Squarespace developer making plugins like Full-Width Blocks, Hover effects for grid gallery and the Darkmode plugin. I know Squarespace inside out and I'm able to solve pretty much any Squarespace code problem.

Get in touch here!

Link to comment
  • 4 months later...
  • 10 months later...

If you're trying to make your site go full width of the browser viewport – this does the trick across devices and it's free. Copy and paste this CSS code into the Page Header Code Injection to create that full screen effect:


.content-inner {
       max-width: 100% !important;
       padding: 0 !important;
}
.collection-type-index .content-inner.has-content {
       padding: 40px !important;
}

And if you're using an Image Block, use the following to eliminate the padding around the image:


.sqs-block.image-block { padding:0 !important; }

This took me forever to figure out. Hopefully it works for all templates.

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.