Trouble with the layout of a YouTube video that is embedded

Over on this particular page, an embedded YouTube video takes up the left side of the screen while a carousel labeled "Similar Festivals" sits adjacent. The code snippet used to embed the YouTube video looks something like this:

This is how the YouTube section is structured in HTML:

<div class="span4 spacer youtube">
    <div class="title clearfix">
        <h2 class="pull-left">YouTube</h2>
    </div>
    <iframe width="1000" height="1000" src="http://www.youtube.com/embed/NI8rQEHoE24"></iframe>
</div>

The design of the webpage, utilizing a flexible Bootstrap grid system, ideally positions the video to be as tall as the accompanying carousel on the right-hand side. Unfortunately, it seems that the video is somehow extending beyond its designated container. Is there a way to realign the video with the carousel for a seamless display?

If needed, here's a snapshot to provide visual clarity on the issue at hand!

Answer №1

After observing the behavior of the row-fluid container, I have discovered that it automatically assigns a width of 33% to any embedded Youtube video. This can override any custom width settings you may have applied.

To resolve this issue, consider using the following code:

<div class="row-fluid">


    <div class="span4 spacer twitter">
    </div>


    <!-- Youtube -->
    <div class="span4 spacer youtube">
        <div class="title clearfix">
            <h2 class="pull-left">YouTube</h2>
        </div>
<iframe height="150px" src="http://www.youtube.com/embed/NI8rQEHoE24"></iframe>        
    </div>

    <!-- Similar Carousel -->
    <div class="span4 spacer">

        <div id="similarCarousel" class="carousel slide last">
        </div>
    </div>

</div>

(special thanks to Mr. Alien)

This code specifically sets the height of the iframe only, preventing the 'jumping out of the container' issue while maintaining a consistent row-fluid container size and irregular height.

Answer №2

Rather than

<iframe id="fitvid811516"
    src="Festivals.ie%20_%20Electric%20Picnic%202012_files/NI8rQEHoE24.htm">
</iframe>

Consider using

<iframe width="640" height="360" 
    src="http://www.youtube.com/embed/NI8rQEHoE24?feature=player_detailpage" 
frameborder="0" allowfullscreen>
</iframe>

You may need to manually adjust the width and height as iframes do not always resize dynamically.

If you wish to maintain the layout without altering the content, you can modify the parent container in HTML and add overflow: hidden

.fluid-width-video-wrapper {
    overflow:hidden;
}

Keep in mind that while this will fix the layout, it may cause the bottom parts of the iframe (such as play controls) to be hidden.

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

Icons positioned centrally while floating to the left

There seems to be an issue with centering the icon CSS: .icons .overview { position: relative; float: left; width: 16.6666666667%; text-align: center; overflow: visible; } .icon { display: inline-block; width: 64px; heigh ...

Add a flexible element to a container without disrupting the alignment of the other

I'm facing a challenge in adding an action button to the end of a grid layout without affecting the centering of the items. The button should seamlessly fit into the grid, just slightly offset. If you check out my demo, you'll see what I mean. ...

Conceal two DIV elements if one of them is empty

My slideshow has thumbnails connected to each slide. There are 10 DIVs representing the slides like this... <div class="SSSlide clip_frame grpelem slide" id="u751"><!-- image --> <?php while ($row = mysql_fetch_array($query ...

CSS can only fade out without hiding afterwards

I'm struggling to create a CSS class and animation that will fade out or move a div along with its contents, resulting in the div having both display:none and visibility:hidden My attempts so far have been unsuccessful! I can either get the animation ...

Utilizing MongoDB for data transfers: uploading and downloading

I successfully configured my localhost to upload files to Mongo DB using server.js //I have configured my ID and PW const mongoURI = "mongodb+srv://myID:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a2cfdbf2f5e2c1ced7d1 ...

Is there a way to determine the items that will be displayed on this page by clicking a link from a different page?

First Page: Whenever a link is clicked, it will redirect to the second page where only the relevant item will be displayed <ul class="portfolio-filters list-inline"> <li ><a href="page2.html/#webdesign-filter">Web ...

Change the <base> element programmatically during server-side rendering

Searching for a way to obtain the base URL for an HTML page, so that relative URL requests from the browser utilize that base. If you are looking for answers, check out this link: Defining root of HTML in a folder within the site root folder When serving ...

Incorporating a clickable link within a variable in an HTML table

I'm attempting to insert a hyperlink into a variable within a table row. Here is my current code: echo "<td>"<a target='_blank' href="'http://alpha.bug.corp.com/show_bug.cgi?id=$ticket_id'"> $ticket_id </a>"</ ...

Displaying items in a row when the navbar is collapsed: Bootstrap 4 tips

Is there a way to change the display of items in the collapsed navbar so that they appear next to each other rather than in a column? You can see how it currently looks here: Navbar collapsed. My goal is to have the image displayed next to the username ins ...

Calculating the total sum of values using a dropdown list as a filter with J

I have successfully implemented a dropdown filter in my jQuery datatable to filter data. However, I am now looking to calculate the sum of all values in the filtered table each time a user selects a value from the dropdown list. How can I achieve this? My ...

Leveraging background images in HTML and CSS to create interactive clickable links

I'm attempting to create the illusion of a clickable background image using HTML and CSS, following a tutorial I found here. Unfortunately, I'm encountering two issues: 1) The link is not fully covering the background image 2) The link does not ...

What is the correct way to display my data in a table using XSLT?

Here is the desired look I'm aiming for I am still learning about xml/xsl, so please point out any errors kindly (: Below is a snippet from an xml file: <weather yyyymmdd="20200616"> <year>2020</year> <month>06< ...

The svh/lvh units are experiencing unexpected issues when using Chrome on an iPhone

I'm facing an issue with my hero section that is supposed to take up the full height of the viewport. I recently tried using the new svh/lvh units, which seemed to work fine on desktop and Safari for mobile. However, when testing on Chrome for mobile ...

Embedding HTML in a Xamarin Forms Label

I am currently developing a mobile app for my website using Xamarin Forms. One of the challenges I am facing is styling HTML content stored in a database field. Although I am utilizing https://github.com/matteobortolazzo/HtmlLabelPlugin, I am struggling t ...

Concealed upper TD boundary in IE 8

I've been struggling all day to figure out this style issue without any success. http://jsfiddle.net/9HP9Q/1/ The table lines should have gray borders around them. It's working fine on all browsers except Internet Explorer 8. .order_table tab ...

What is the best way to trigger form submission when the value of an input element changes?

I am currently developing a website using Bootstrap and I am exploring the idea of incorporating a toggle button to alter the color scheme by simply toggling it. I have successfully created a toggle button similar to a checkbox, but now I am looking for ...

Using setInterval on a batch of freshly generated div elements

I am interested in creating a small website where I can display multiple clocks for various time zones. However, I have encountered an issue with the setInterval function. Below is the code snippet: function addClock () { $("#container").append('& ...

Troubleshooting Problems with CSS Media Queries on Various 1280 screens

I'm facing an issue with creating a responsive layout using CSS media queries to adapt to different screen resolutions. Even though I've set up Media Queries for specific resolutions like: /*1280 x 1024*/ /*1280 x 960*/ /*1280 x 800*/ /*1280 x 7 ...

Develop a custom content management system that utilizes GET parameters for enhanced functionality

Creating a news system for is my current project and it consists of 3 main pages: index.php | This page displays the latest news and allows users to select which article to read article.php | Users can view the full news post on this page post.php | Thi ...

Utilize CSS to display line breaks within a browser output

If I wrap text in a <pre> element, line breaks will be displayed in the browser without needing to use <br/> tags. Can this same effect be achieved by utilizing CSS with a <div> element? ...