The issue of excessive vertical spacing occurring between two <div> elements, with one of them containing an <iframe> element, needs to be addressed

I am facing an issue with unwanted vertical spacing between two elements. One of them has a <p> element, and it seems like it's getting stuck there. The problem only arises on larger screens (> 15"), while it looks fine on smaller screens. The spacing increases as the screen size gets larger. I'm stuck and need help to resolve this issue.

Code:

<p class="w3-text-grey"><b><i>Task 3.</i></b>
            Investigate the convergence of the functional sequence \( f_n(x) = \frac{1}{n^2+x^2}\).
            </p>
            <div class="embed-responsive embed-responsive-16by9" >
              <iframe scrolling="no" title="Exercise 5" src="https://www.geogebra.org/material/iframe/id/e6jpyxer/width/1580/height/871/border/888888/sfsb/true/smb/false/stb/false/stbh/false/ai/false/asb/false/sri/false/rc/false/ld/false/sdz/false/ctl/false" style="border:0px; max-width:1000px; max-height:558px" allowfullscreen> </iframe>
            </div>
            <!--The unwanted spacing occurs here! -->
            <div class="container-fluid float-left">   <!-- Button  Solution -->
              <a href="#task3" class="btn btn-secondary" data-toggle="collapse"><i>Solution</i></a>
              <div id="task3" class="collapse">
                <p class="w3-text-grey">
                  <br>
                  By observing the graph of the sequence, it can be concluded that the limiting function of this sequence is \( f(x) = 0\).
                  <br>
                  Indeed, since \( |f_n(x)| \leq \frac{1}{n^2}\) for all \( x\in \mathbf{R} \), we have \( \displaystyle\lim_{n \to \infty }{\sup_{x\in \mathbf{R}}{|f_n(x)-f(x)|}}= \) \( \displaystyle\lim_{n \to \infty }{\sup_{x\in \mathbf{R}}{\Bigg|\frac{1}{n^2+x^2}\Bigg|}}=  \)
                  \( \displaystyle \lim_{n \to \infty}\frac{1}{n^2}=0\).
                  Therefore, \(f_n\rightrightarrows f\).
                  <br>
                  <br>
                </p>
              </div>
            </div>

Link to the problematic page: http://alas.matf.bg.ac.rs/~ml05184/strana2.html

Here is the screenshot

Answer №1

The issue lies in the padding-top value of your element .embed-responsive-16by9::before, which is currently set in percentage. Consider changing it to pixels for better display on larger screens.

@media screen and (min-width: 1440px) {
    .embed-responsive-16by9::before {
     padding-top: 98px;
   }
}

Note: 1440px == 15"

By adjusting the padding to pixels, the result will appear correctly on bigger screens like the example shown https://i.sstatic.net/hZgPh.png

Answer №2

@Viira Thank you so much!

By adjusting the padding to match the height of my iframe element, it now functions perfectly.

@media screen and (min-width: 1440px) {
    .embed-responsive-16by9::before {
     padding-top: 550px;
   }
}

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

Tips for personalizing checkbox group in a Zend framework-2 form

Could someone please help me understand how Zend Framework 2 generates HTML for a form element? Here is an example: $others = new Element\MultiCheckbox('others'); $others->setLabel('Others') ->setAttribute('name ...

Navigating Through Siblings with Http Agility Pack

When it comes to working with the HTML Agility Pack, it's easy to extract descendants and entire tables. However, how can you utilize this tool in a unique situation like the example below? ...Html Code above... <dl> <dt>Location:</dt ...

Altering the value of a global variable through a local function in JavaScript

I have developed a straightforward piece of Java script code. I'm looking to update the value of a global variable using a local function. Whenever I trigger the value1() function, I want the output to display as "2". Is there a way I can achieve this ...

Instant feedback from dynamically generated text boxes

As a Python developer, I am venturing into the realm of HTML. Currently, I am working on an internal tool that enables users to create directories for various projects. To achieve this, I have implemented a method for dynamically adding and removing text b ...

What is the best way to transform this unfamiliar CSS element into JavaScript code?

I'm facing an issue where I want to animate a CSS image based on time constraints, but since it's in CSS, I'm unable to achieve the desired effect. The animation in question is not the sun itself, but rather a yellowish half-circle animation ...

Employing the Confirm() function within the onbeforeunload() event

Is there a way to prompt the user with a confirmation box before exiting a page using JavaScript? If the user clicks "OK", a function should be executed before leaving the page, and if they click "Cancel", the page should remain open. window.onbeforeunloa ...

jQuery does not provide the reference of a basic canvas element

I'm having trouble with a simple initialization function that is supposed to create a canvas element in the body and save its reference in a variable. No matter what I try, jQuery doesn't seem to want to return the reference. I attempted refere ...

Unable to click on hyperlink and image not adjusting in size

I am having an issue with the anchor tags inside a div. For some reason, the width and height are set to 0px, and I have tried to adjust them with no success. Each dot in my onepage scroller is meant to navigate to a different page. .dotstyle-scaleup{ f ...

Difficulty filling height with Bootstrap 4 flex-grow

I am in need of creating a layout with a header div at the top (that can be filled with content), a footer div at the bottom, and a middle div with an adaptable height to fill the entire screen. Check out my code below: <div class="container-fluid p-0 ...

Distinct vertical menus with varying widths but sharing the same CSS code for the submenus

How can I create a vertical menu bar with submenus on the right side? The first submenu appears correctly, but the second one is narrower than the first. It seems like they have the same code, yet they look different. Below is the HTML code: <div clas ...

Can you explain the distinction between "javascript:;" and "javascript:" when used in the href attribute?

Can you explain the distinction between using "javascript:;" and just "javascript:" within an anchor tag's href attribute? ...

Calling JavascriptInterface in an H5 environment is not permitted

Utilizing the power of vue, I created an immersive h5 page within the application framework. The seamless connection between the page and the app relies on the use of window.JSInterface for communication. My current challenge lies in invoking the JSInterfa ...

Is it possible to use v-if in conjunction with a style tag to specify a different source file? Alternatively, is there a more efficient method I

I attempted the example provided below, but unfortunately, it did not function as expected. The reason behind my endeavor is that adding numerous modifiers (--tuned) to achieve the desired outcome seemed impractical. Therefore, I decided to try and link ...

Nested Tables in JavaScript: Creating Tables within Tables

Recently, I have been analyzing student data and noticed a recurring structure. While preparing to present information on student performance within the discipline, I also became interested in showcasing a history of new students. It was suggested that hav ...

What is the functionality of client-side applications?

I am new to web development and my programming background is primarily focused on algorithms and creating visualization tools using local Windows forms. I often distribute these tools via email as compiled exe files (C++ or C# win form) to my math students ...

Attempting to retrieve an image from a specified div ID within Android Studio

I find myself at a loss for where to even begin with this issue, so I've been stumbling through it. While I've come across some similar posts, I haven't had any success in making them work. My goal is to utilize the div id to retrieve a spe ...

What is the best way to horizontally align a button with CSS?

I need help with positioning a button on my web page. The button looks great, but it's currently off to the left and I want it centered below the main text. Any suggestions on how to achieve this? <!DOCTYPE html> <html lang=""> <head& ...

What methods can we use to transform Bootstrap rows and columns to resemble a table design?

Attempt number one did not work due to padding issues in the columns. Attempt number two also failed, leading me to believe I may be making a mistake somewhere. This is what I am aiming for: https://i.sstatic.net/yTz6o.png Can anyone provide some assis ...

Guide to creating animated sections using only CSS as you scroll the webpage

I am searching for a method to add animation effects (using @keyframes, transform...) to certain elements as the user scrolls down the page. For instance: When the offset is 0: the div will have a height of 100px. When the offset is between 0 and 100: th ...

What is the best way to ensure that all components within a Container automatically inherit its calculated width?

Check out my tab panel setup on Sencha fiddle. The buttons are dynamically added to a tabs container with a layout of hbox within a vbox. The width of the tabs container is determined by the flex property. I attempted to set each button's width to &a ...