Incorporating a dynamic iframe into a 3 column fluid div arrangement

Apologies in advance, as I am new to this! I am currently working within a CMS for my company and attempting to utilize div tags instead of tables to align content properly for our adaptive mobile site.

My issue lies in trying to embed a YouTube video within a 3 div/column layout. While I can successfully display 3 divs across with percentage width using float and make the YouTube embed responsive on its own page, combining the two seems to be causing a conflict. Here is the code I am working with:

<style type="text/css">
  .embed-box {
    position: relative;
    padding-bottom: 62.25%;
    /* ratio for youtube embed */ padding-top: 30px;
    height: auto;
    overflow: hidden;
  }
  .embed-box iframe, .embed-box object, .embed-box embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
</style><span style="font-size:18px;"><strong>Lehigh Athletics Department Awards and Achievements</strong></span>
<hr /> <span style="font-size:16px;"><strong>Highlights of 2013-2014 Convocation</strong></span>
<div class="bottom">
  <div style="float: left; width: 33%;">
    <img style="" src="/common/controls/image_handler.aspx?thumb_id=0&amp;image_path=/images/2014/5/6/ProgramIcon.png" />
  </div>
  <div class="embed-box">
    <div style="float: left; width: 33%;">
      <iframe src="http://www.youtube.com/embed/zQmxGbFbgXc" frameborder="0" allowfullscreen=""></iframe>
    </div>
  </div>
  <div style="float: left; width: 33%;">
    <img style="" src="/common/controls/image_handler.aspx?thumb_id=0&amp;image_path=/images/2014/5/6/ProgramIcon.png" />
  </div>
</div>

Answer №1

Why not test out this new layout? I've revamped your CSS and HTML to remove all the clutter that wasn't quite cutting it for me. It's now responsive and includes a Youtube embed.

Check it out on CodePen

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

Out of the DIVs floating left and right, which one is positioned first?

Is the order of <div> elements in HTML important? If it is, what is the reason behind it? .float-left{float:left;} .float-right{float:right;} <div> <div class="float-left">Left</div> <div class="float-right">Right</ ...

incorrect indexing in ordered list

I am facing an issue with the ngIf directive in Angular. My objective is to create a notification system that alerts users about any missing fields. Here's a stackblitz example showcasing the problem: https://stackblitz.com/edit/angular-behnqj To re ...

What is the best way to incorporate the :after pseudo-element in JavaScript code

HTML: This is my current code snippet <div class="one"> Apple </div> I am looking to dynamically add the word "juice" using JavaScript with the .style property. Is there an equivalent of :: after in CSS, where I can set the content in JavaS ...

What could be causing the p tag to be displacing the parent div downwards?

Can someone help with an issue I'm having? I have two divs that are supposed to take up half of the screen each. However, when I add a p tag inside the second div, it gets pulled down. I am working on creating an HTML email, so I can only use inline s ...

Guide on fetching and parsing JSON data in jQuery by utilizing a URL

As a newcomer to jquery, I am struggling to understand and parse the json format. In my icenium project, I have included this JavaScript function in my js folder but it doesn't seem to be functioning properly. $(document).ready(function () { ...

Conceal the ::before pseudo-element when the active item is hovered over

Here is the code snippet I am working with: <nav> <ul> <li><a href="javascript:void(0)" class="menuitem active">see all projects</a></li> <li><a href="javascript:void(0)" class="menuitem"> ...

jQuery: Modifying the Style of obj "th" Element

I am looking to update the style of my selection using jQuery. After using this module to retrieve all items, I have a list of cells with new coordinates. //cell list with new coordinates cl = Object {0-0: th, 0-1: th, 0-2: th, 0-3: th, 1-0: td…}, id = ...

Submit button not found within the form element

Currently, I am in the process of designing a form layout that does not include a submit button within the <form> tags. Here is an example to clarify: http://codepen.io/timsim/pen/aJjdGa The design concept I am working on requires the input data to ...

Tips for optimizing the display of a website on mobile devices

I'm facing an issue with the layout of a table and an image on mobile devices. On PC, they display correctly side by side but on mobile, the image overlaps the table or remains next to it. I built the table using Bootstrap 4 as a requirement. I attemp ...

Guide to activating the timer specifically on select pages with jQuery Mobile

I've developed a quiz application using jQuery Mobile and I am working on implementing a timer feature. The timer should run from 0 seconds up to 1 hour but only when the user is viewing specific pages, specifically the question pages. The timer is di ...

How can I retrieve information from a MySQL Table and display it on an HTML page?

Seeking Solution, I've experimented with Node.JS, but unfortunately, it does not seem suitable for webpage functionality. Online resources mostly discuss displaying HTML through Node.JS without mentioning SQL integration. My experience with PHP is l ...

Heroku fails to recognize the fragments I have created

After successfully deploying my Spring application on Heroku, I encountered an issue when trying to test its functionality. A message appeared saying: Error resolving template "/fragments/head.html", template might not exist or might not be accessible by a ...

I prefer showcasing the contents at the top of the page instead of the bottom

Is there a way to show the message for the $myGame variable after submitting a post? <!DOCTYPE HTML> <html> <head> </head> <body> <?php $myGame = ""; if ($_SERVER["REQUEST_METHOD"] ...

The Angular boilerplate and Twitter Bootstrap 3 make for a powerful combination in

I've been attempting to integrate Twitter Bootstrap 3 into this project found at https://github.com/ngbp/ngbp, but I haven't been able to find any information on how to do so. Could it be that: It's simply not possible It's not recomm ...

Tips for creating two interchangeable lists and saving the selected items when the selection process is finished

Utilizing jQuery and specifying dual selectors together, I attempt to reference each variable in the following code: UL_HeadersToOmit - represents the list to select from UL_dropedCols - indicates the list to be passed as a reference to the subsequent fu ...

Tips for creating a div element with a width that is close to 100%

I have a snippet of HTML code that looks like this: <div id="outer"> <div id="inner"></div> </div> Is there a way to adjust the #inner div so it takes up 100% width of #outer but with a 10px margin? This is my current CSS sty ...

What is the best way to ensure uniformity in my boxes (addressing issues with whitespace and box-sizing using flexbox)?

Below is the code I have written: body { padding-top: 20px; text-align: center; background-color:black; } h1 { display: inline-block; background: white; } h1 { font-size: 30px } p { background: yellow; } .container { display: flex; ...

The parameter type 'Event' cannot be assigned to the argument type

edit-category-component.html: <custom-form-category *ngIf="model" [model]="model" (onSaveChanges)="handleChanges($event)"></custom-form-category> <mat-loader *ngIf="!model"></mat-loader> edi ...

When using JavaScript to dynamically load canvases and create drawing contexts within a function, the context may suddenly disappear

Currently, I am modifying the canvases displayed through ajax calls and also updating what is drawn on each canvas. The primary issue I am facing is that my main drawing function fails on getContext and there are some unusual behaviors such as missing canv ...

Automatically adjust the size of a parent div that houses two child divs

@media only screen and (min-width: 900px) { .map_left { display: inline; float:left; width: 100px; height: 100px; border: 3px solid green; } .map_right { display: inline; float:right; width: 100px; height: 100 ...