Displaying full-width video without cropping or adding extra space on the sides?

shane53
125 Posts
shane53 posted this 24 November 2022
Ask a Question

Hi Nicepage,

I have a client that wants to use a video as a hero "image" on the home page. Using the default video element you have an option of either using "Cover" (cropping the video) or "Contain" (adding extra space). My client doesn't want either.

In html I can simply create an audio element in a container and it works perfectly upon resizing. It resizes without changing the aspect ratio, and doesn't create any extra space or crop the sides. If I try to do this in Nicepage using an HTML element, the containing block (blue border) adds space below the video element (red border) as the page is resized as if the block is wrapping the space below.

Thank you.

Screenshot-2022-11-24-at-1.32.14-PM.png
Screenshot-2022-11-24-at-1.32.06-PM.png
Screenshot-2022-11-24-at-2.01.26-PM.png
Screenshot-2022-11-24-at-2.01.40-PM.png
Hi Nicepage, I have a client that wants to use a video as a hero "image" on the home page. Using the default video element you have an option of either using "Cover" (cropping the video) or "Contain" (adding extra space). My client doesn't want either. In html I can simply create an audio element in a container and it works perfectly upon resizing. It resizes without changing the aspect ratio, and doesn't create any extra space or crop the sides. If I try to do this in Nicepage using an HTML element, the containing block (blue border) adds space below the video element (red border) as the page is resized as if the block is wrapping the space below. Thank you. !Screenshot-2022-11-24-at-1.32.14-PM.png! !Screenshot-2022-11-24-at-1.32.06-PM.png! !Screenshot-2022-11-24-at-2.01.26-PM.png! !Screenshot-2022-11-24-at-2.01.40-PM.png!

Last edited 24 November 2022 by shane53

Vote to pay developers attention to this features or issue.
4 Replies
Order By: Standard | Newest
shane53
125 Posts
shane53 posted this 24 November 2022

I figured it out and thought I'd document it in case anyone ran into this issue. I had to go into the block css and add the following declaration:

display: contents;

So my CSS for the video element and the block containing it looks like this:

    .hero-vid {
    width: 100%
    }

.video-container {
    display: contents;
    }

I've never used this value for the display property before. The display: contents declaration "makes the container disappear, making the child elements children of the element the next level up in the DOM".

Maybe this should be added as a third option for video elements. Once you know how to do it, it seems really simple.

The Nicepage editor doesn't display it properly as it's trying to display the video element 100% across the editor page, but at least it works on the front end.

Screenshot-2022-11-24-at-2.34.19-PM.png
I figured it out and thought I'd document it in case anyone ran into this issue. I had to go into the block css and add the following declaration: display: contents; So my CSS for the video element and the block containing it looks like this: .hero-vid { width: 100% } .video-container { display: contents; } I've never used this value for the display property before. The display: contents declaration "makes the container disappear, making the child elements children of the element the next level up in the DOM". Maybe this should be added as a third option for video elements. Once you know how to do it, it seems really simple. The Nicepage editor doesn't display it properly as it's trying to display the video element 100% across the editor page, but at least it works on the front end. !Screenshot-2022-11-24-at-2.34.19-PM.png!

Last edited 24 November 2022 by shane53

Support Team
Support Team posted this 25 November 2022

Hi Shane,

We recommend to resize the block with the video in each responsive mode separately, also you can set a video as the block background.
Also it is good to hear that you have found a solution.

...................................................
Sincerely,
Hella
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi Shane, We recommend to resize the block with the video in each responsive mode separately, also you can set a video as the block background. Also it is good to hear that you have found a solution. ................................................... Sincerely, Hella Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
shane53
125 Posts
shane53 posted this 14 June 2023

I noticed DIVI does the same thing - forces a static block height.

After updating Nicepage my solution stopped working so I've been resizing responsively. Fortunately my picky client seems fine with it.

I noticed DIVI does the same thing - forces a static block height. After updating Nicepage my solution stopped working so I've been resizing responsively. Fortunately my picky client seems fine with it.
jirinovy6
1 Posts
jirinovy6 posted this 22 January 2024

Hi,

I have a similar problem with YT video. I read a similar content there on the forum. But this is 6 years old! Really you still don't have a solution NICEPAGE?

I want responsible website, where will be 4 videos. For example.

First video has own block, align left and video has width: 60 % of page. But I want to have Height as auto. Because when I set height manually, so video does not responsible! I see black frame on the left and right or top and down.
Second video has own block, after first video, align right, and width: 60% of pages.
etc...

How to make height as auto? Responsible.

When I upload video to hosting and I use Nicepage videoplayer, will be work it?

enter image description here
enter image description here
Hi, I have a similar problem with YT video. I read a similar content there on the forum. But this is 6 years old! Really you still don't have a solution NICEPAGE? I want responsible website, where will be 4 videos. For example. First video has own block, align left and video has width: 60 % of page. But I want to have Height as auto. Because when I set height manually, so video does not responsible! I see black frame on the left and right or top and down. Second video has own block, after first video, align right, and width: 60% of pages. etc... How to make height as auto? Responsible. When I upload video to hosting and I use Nicepage videoplayer, will be work it? ![enter image description here][1] ![enter image description here][2] [1]: https://i.postimg.cc/q71Ly8NT/temp-Image-O1-QEAW.jpg [2]: https://i.postimg.cc/63zD72X2/temp-Imagew7-Cy-Ln.jpg

Last edited 22 January 2024 by jirinovy6

You must log in or register to leave comments