Overflow issues arise when incorporating an embedded iframe (YouTube) into a Bootstrap website, hindering the visibility of surrounding

So, I have a youtube video embedded on my page and when I resize the page, the video frame doesn't adjust responsively like the rest of the content. It overflows and blocks other site content.

I'm looking to make it responsive if possible or at least prevent it from blocking other content by adding a divider.

I'm pretty new at bootstrap/html/css so apologies if this is an easy fix and I'm just missing something obvious. Any help would be greatly appreciated, thank you.

Video of the issue: Code:


        <div class="bg container-fluid text-center" id="GFX">
            <div class="text-center title">
                <h1>GFX</h1>
            </div>
            <hr/>
            <div class="container-fluid overflow-hidden">
                <iframe src="https://albumizr.com/a/TO-n" scrolling="yes" frameborder="0" allowfullscreen width="700" height="700"></iframe> 
            </div>
            <hr/>
        </div>

        <hr>

        <div class="bg embed-responsive-16by9 text-center" id="Video">
            <div class="text-center title">
                <h1>Video Editing</h1>
            </div>
            <hr/>
            <div class="container-fluid overflow-hidden">
                <iframe class="text-center embed-responsive-item " width="1280" height="720" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLwf6BHzjcncmOoDkyKM8PNAnYhRHkbXub" frameborder="0"  autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
            </div>
            <hr/>
        </div>

        <hr/>
        <br>

        <div class="bg container-fluid text-center" id="Music">
            <div class="text-center title">
                <h1>Music Production</h1>
            </div>
            <hr/>
            <div class="container-fluid overflow-hidden">
                <iframe class="text-center" width="100%" height="auto" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/677510388%3Fsecret_token%3Ds-q8lC3&color=%230d58e7&auto_play=false&hide_related=false&show_comments=false&show_user=true&show_reposts=false&show_teaser=true"></iframe>
            </div>      
            <hr/>
        </div>

        <hr/>
    

Answer №1

When you resize the main page window, the inner content of an iframe element does not automatically resize. This is simply how iframes operate. To dynamically resize the content within an iframe, you can refer to a solution provided in this link: How to set iframe size dynamically (which involves utilizing some javascript code).

Answer №2

To make an iframe responsive, you can utilize the max-width property.

iframe {
  max-width: 100%
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>
<body>
<div class="bg container-fluid text-center" id="GFX">
<div class="text-center title">
<h1>GFX</h1>
</div>
<hr/>
<div class="container-fluid overflow-hidden">
<iframe src="https://albumizr.com/a/TO-n" scrolling="yes" frameborder="0" allowfullscreen width="700" height="700"></iframe> 
</div>
<hr/>
</div>

<hr>

<div class="bg embed-responsive-16by9 text-center" id="Video">
<div class="text-center title">
<h1>Video Editing</h1>
</div>
<hr/>
<div class="container-fluid overflow-hidden">
<iframe class="text-center embed-responsive-item " width="1280" height="720" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLwf6BHzjcncmOoDkyKM8PNAnYhRHkbXub" frameborder="0"  autoplay; encrypted-media; gyroscope; picture-in-picture allowfullscreen></iframe>
</div>
<hr/>
</div>

<hr/>
<br>


<div class="bg container-fluid text-center" id="Music">
<div class="text-center title">
<h1>Music Production</h1>
</div>
<hr/>
<div class="container-fluid overflow-hidden">
<iframe class="text-center" width="100%" height="auto" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/677510388%3Fsecret_token%3Ds-q8lC3&color=%230d58e7&auto_play=false&hide_related=false&show_comments=false&show_user=true&show_reposts=false&show_teaser=true"></iframe>
</div>      
<hr/>
</div>

<hr/>
</body>

<!-- Scripts are here -->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</html>

Answer №3

Check out this code snippet:

<div class="container-fluid overflow-hidden">
   <div class="row">
       <iframe class="text-center embed-responsive-item "></iframe>
   </row>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The functionality of the Bootstrap blog template is not aligning with its intended purpose

Currently, I am implementing a solution from the following link: http://www.bootply.com/86704 However, I am facing an issue where it is occupying the entire vertical space of my webpage. I would like to integrate this into my site, but positioned below ...

Code snippet for positioning a div element above a canvas when clicked on the canvas

Currently, I am working on connecting an HTML5 canvas element with an event listener for clicks to a floating div that will appear exactly where the user clicks on the canvas. Can anyone provide any suggestions or code snippets for the best way to achieve ...

Ensure that the flex item spans the entire width of the page

I'm struggling to make my audio-player resize properly to fit the full width of my page. I can't seem to figure out what I'm missing or doing wrong... (Current Look) https://i.sstatic.net/tEtqA.png I'm attempting to utilize HTML cust ...

Importing fonts using CSS

Currently, I have 4 different fonts that I need to incorporate into a website, and their files are saved within my website folder. Baskerville.ttc BellGothicstd-Black.otf BellGothicstd-Bold.otf JennaSue.ttf I attempted to import the fonts using @Import, ...

Implementing a Popover Notification When Clicked

I'm a beginner at this. I came across an example of a popover message box in the link provided below. I attempted to implement it, but for some reason, it's not working. Could I be overlooking something? Alternatively, is there a simpler way to ...

I can't seem to get my JavaScript to connect to my HTML file. What should I do next?

I'm facing a major issue at the moment. My HTML file doesn't seem to be linking properly with my JavaScript file, even though they are located in the same folder. The script link is correctly placed in the HTML file, but for some reason, it just ...

CSS image buttons are causing active_link_to list items to disappear when they become inactive

I'm struggling to get the nth css button/list elements to display correctly using active_link_to. The first css button appears without any problems and is active, but when I try to add new buttons to the list, they seem to disappear. HTML <li cla ...

Steps to vertically arrange a grid in Bootstrap

I've set up a basic grid layout using Bootstrap 5: <div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3"> <div class="col border">Field1</div> <div class="col border">Field2</div> ...

Discovering if the current user selection falls within a particular HTML tag using summernote

I am looking to enhance the functionality of a button in summernote that I created to insert a h4 tag into a selection: heading: function (context) { var ui = $.summernote.ui; var button = ui.button({ contents: ' ...

Creating a Website for Compatibility with NoScript

During my journey of building a nameplate site from the ground up for myself, I have delved into the realms of learning and establishing my online presence. The highlight of my project is a sleek tabbed site that employs AJAX and anchor navigation to seaml ...

What's the best way to ensure that your item list automatically updates the rendered list when an item is deleted

I've developed a web cart using Redux. The cart functions as expected, except for one issue - when I delete an item from the cart, the changes are only displayed after refreshing or navigating to another page. How can I update the view dynamically as ...

How can Selenium be used to verify if an HTML5 validation has been activated?

When testing my web application with Selenium, I rely on HTML5 form validations for all the form validation. Is there a method in Selenium to verify if a form/input validation was triggered? ...

Unable to bypass YouTube advertisement

I am currently experimenting with using nodejs puppeteer to test if I can bypass the ad on Youtube. Although this is just for testing purposes, I am facing some challenges with getting it to work as expected. I have implemented a while loop to search for ...

What is the best way to determine if this statement is redundant or not?

I am attempting to generate a file with PHP that includes a substantial amount of HTML content and MySQL queries. The issue arises on line 3, indicated by the downward-facing arrow. The primary error identified is an excess of single inverted commas causi ...

What is the method for showcasing AM and PM in various languages within the input type of time?

I am using the input type="time" like this: <input type="time" id="openTime" name="openTime" value=""> My inquiry is regarding how to localize the display of AM - PM in another language? ...

What steps are involved in creating a webpage cleaner similar to Arc90's Readability or Instapaper?

Curious about cleaning up an HTML page to present it in a more polished manner - eliminating clutter and restructuring the main text for better readability, similar to resources like or Instapaper. Would the process involve basic page parsing and filteri ...

Eliminating undesired borders of table cells using CSS

I am facing a unique and puzzling issue. Here is the simple markup: <table> <thead> <tr><th>1</th><th>2</th><th>3</th></tr> </thead> <tbody> <tr>< ...

Getting hold of HTML elements in a div on a different page

Recently diving into the world of html/javascript, I find myself engaged in a project where I'm loading an external html page within a div. The loaded content looks like this: <div class="content" id="content"> <object ty ...

Is there a way to expand "row" elements to the left side in Bootstrap?

<div class="container-fluid"> <div class="row"> <!-- Left side --> <div class="col-xl-10 style"> <div class="row" > <div class="col-xl-12 style">Box1< ...

Creating an Android app using PHP, HTML, and Javascript: A step-by-step guide

I successfully developed a web application using PHP, HTML, and Javascript. My next goal is to transform it into an Android app. Can someone guide me on the process of converting a web application into an Android app? What specific tools will I need for ...