- This topic has 17 replies, 4 voices, and was last updated 2 years, 6 months ago by Ying.
-
AuthorPosts
-
October 6, 2021 at 4:11 pm #1955313GeneratePressUser
Hello Team,
Pls can you tell how can we embed 2 youtube videos side by side.
See the link in private box.
October 6, 2021 at 6:49 pm #1955370LeoStaffCustomer SupportHi there,
You can use a grid block from GenerateBlocks to create columns and insert an YouTube embed block in each container:
https://docs.generateblocks.com/article/grid-overview/You can also consider using the Columns block from WordPress core but it offers less options and controls for the columns.
Let me know if this helps ๐
October 6, 2021 at 7:07 pm #1955378GeneratePressUserHello Leo,
We have disabled gutenberg and gutenberg is not available for woocommerce products.
Is there a manual code which can be used or any other way?
October 6, 2021 at 7:11 pm #1955383ElvinStaffCustomer SupportHi there,
We can do this with CSS like this –
div#tab-description { display: flex; justify-content: space-between; }
But this is not an ideal solution as this will apply to all descriptions of products.
Can you edit the HTML structure of the videos in the description to wrap it with a div?
example:
<div class="video-desc-grid"> //video #1 here //video #2 here </div>
And then do this CSS instead
div#tab-description div.video-desc-grid { display: flex; justify-content: space-between; }
October 7, 2021 at 1:47 pm #1956456GeneratePressUserHello Elvin,
Thanks a lot, wrapping them around div worked perfectly ๐
October 7, 2021 at 1:51 pm #1956460GeneratePressUserHello,
It seems on mobile they appear sticking together which looks weird, pls can you tell what can be done to make them look responsive.
October 7, 2021 at 2:48 pm #1956507LeoStaffCustomer SupportYou’d need to do something like this to make it responsive:
https://docs.generatepress.com/article/responsive-videos/October 7, 2021 at 5:01 pm #1956560GeneratePressUserHello,
I guess I need to merge that with your given CSS, to get both responsiveness and also proper alignment.
October 7, 2021 at 5:19 pm #1956566ElvinStaffCustomer SupportYeah that’s about right.
Example:
<div class="video-desc-grid"> <div class="videoWrapper"> // Your video embed code </div> <div class="videoWrapper"> // Your video embed code </div> </div>
And its CSS:
div#tab-description div.video-desc-grid { display: flex; justify-content: space-between; } div#tab-description div.video-desc-grid .videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 25px; height: 0; } div#tab-description div.video-desc-grid .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
October 10, 2021 at 9:25 am #1959119GeneratePressUserHello,
I did that and it seems the videos disappeared, pls can u check.
October 10, 2021 at 2:25 pm #1959307GeneratePressUserIt seems the topic was marked resolved, actually after using the code videos disappeared, you can visit the page and see.
October 10, 2021 at 8:52 pm #1959400ElvinStaffCustomer SupportTry this instead:
div#tab-description div.video-desc-grid { display: flex; justify-content: space-between; } div#tab-description div.video-desc-grid .videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ margin-top: 25px; flex: 0 1 49%; } div#tab-description div.video-desc-grid .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 400px }
Change the height value to your preference.
October 13, 2021 at 1:59 pm #1962634GeneratePressUserThat leaves a lot of space at bottom but on mobile it then looks weird, on mobile it should look 1 below the other, just on desktop it should be side by side.
October 13, 2021 at 2:27 pm #1962658YingStaffCustomer SupportYou just need to add a media query to the CSS Elvin provided so it only applies on desktop:
@media (min-width: 769px) { div#tab-description div.video-desc-grid { display: flex; justify-content: space-between; } div#tab-description div.video-desc-grid .videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ margin-top: 25px; flex: 0 1 49%; } div#tab-description div.video-desc-grid .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 400px } }
October 13, 2021 at 2:45 pm #1962666GeneratePressUserHey Ying,
Thanks a lot, it worked, I did some changes I made it <object> code instead of iframe, so I no longer had to use:
position: relative;
padding-bottom: 56.25%; /* 16:9 */
margin-top: 25px;Now just 1 more thing, can you tell how can I reduce its height a bit?
-
AuthorPosts
- You must be logged in to reply to this topic.