Jump to content

Make Video Centered On Mobile

Recommended Posts

Posted

Site URL: https://scarlet-grape-g5ln.squarespace.com

I need help with centering my home page's first video that autoplays on mobile without affecting the desktop version.

On mobile, it only shows the bottom right corner of the video but in the top left corner of the block.

My current code that I am using for this is below (from @codeandtonic @8640-codeandtonic)

/*
Section background image 16:9 video
*/

//show on mobile
section.page-section[data-section-id="61019a7c2ef1a604d30e6b10"] {

display: block;

}

// show on desktop
html.no-touch section.page-section[data-section-id="61019a7c2ef1a604d30e6b10"] {

  display: block !important;}


section.page-section[data-section-id="61019a7c2ef1a604d30e6b10"] {
  //16:9 spacer
  padding-bottom: 56.25%;
  min-height: 0 !important;
    .section-background  .sqs-video-background iframe {
    //make it the size of parent no matter what automatic JS it would like to do
    border-width: 0;
    position: absolute !important;
    top: 5.5vh !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    height: 10vh;
    width: 100% !important;
    height: 100% !important;
  }
  
  // blocks would be here but we won't have any
  .content-wrapper{
    display:none !important;
  }
}

 

IMG_7152.PNG

IMG_7153.PNG

  • Replies 1
  • Views 384
  • Created
  • Last Reply

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.