Styling the CSS Element positioned to the left side of an Iframe

I am currently faced with a challenge where I have a css element positioned on-top of an iframe. What I actually need is for them to be aligned on the same line, but for some reason I just can't seem to figure it out.

 <div class="tsk">
 <p>Words</p></div>
 </div>

.tsk{
 line-height:1.4em;
 font-size: 1em;
 padding:25px;
 width:30%;
 color:#FFF;
 background: rgba(75,123,365,.5);
 float: center;
 text-align:left;
 border-radius:50px 50px 0px 0px;
 }


 iframe{
 width:70%;
 height:500px;
 }

Answer №1

To properly position the content, apply float: left; to the tsk div and float: right; to the iframe:

.tsk {
    line-height:1.4em;
    font-size: 1em;
    padding:2%;
    width:25%;
    color:#FFF;
    background: rgba(75, 123, 365, .5);
    float: left;
    text-align:left;
    border-radius:50px 50px 0px 0px;
}
iframe {
    width:70%;
    height:500px;
    float: right;
}

An extra </div> tag is present in the html code and needs to be removed.

<div class="tsk">
    <p>Content</p>
</div>
<iframe src="#"></iframe>
<div style="clear: both;"></div>

Make sure to add a clear fix after the iframe to properly handle the floated elements.

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

Through the implementation of JavaScript, the element's class is dynamically altered

While working on my project, I encountered an issue with implementing a change in the class of an element using JavaScript. The problem is that when I click on the home page, the last page does not get deselected. Here is my current JavaScript code: const ...

How to implement downloading a PNG image with a click using Bootstrap 4 and JavaScript

Whenever I click on a picture, my goal is to immediately download it. The image is SVG, but there's an URL for a PNG version. It has been confirmed that the content disposition is set to attachment, and when the URL is directly copied, a download proc ...

Selenium throws errors when elements become stale or are not clickable

I am a beginner when it comes to coding and I recently started it as a hobby. Please bear with me if my terminology is not entirely accurate. I have written a script that navigates to a webpage, continuously refreshes it until a certain element (currently ...

Troubleshooting: Rails Submit Button Not Responding to Bootstrap's btn-block Class

Currently, I am encountering an issue with the btn-block class while styling my Rails application using the bootstrap-sass gem specifically in a new user registration form. Outlined below is the relevant code... <%= link_to "Sign in with Facebook", ...

Is an image with solid colors placed on top of a see-through banner and

I'm facing an issue where my image, despite being set to 100% opacity, appears partially transparent and shows the banner and background image behind it. How can I resolve this problem? Below is the snippet from my style sheet: #banner{ width:12 ...

I am attempting to get a jquery plugin to function properly on my Windows 7 Internet Explorer IE7 browser. The plugin in question can be found at http://jvectormap.owl-hollow

I'm encountering some strange issues with my Internet Explorer IE7 browser on Windows 7. The jquery plugin I am attempting to use can be found at . Unfortunately, this plugin is not functioning properly on Internet Explorer IE7 on Windows 7, but it ru ...

The order of execution for JavaScript functions may get disrupted when using the sleep function

My goal is to hide a specific element and then display a different element after waiting for one second. Here's the simplified version of my code: function pause(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++ ...

My website footer is falling short and not reaching the bottom of the page

I've encountered an issue where my footer is not extending all the way down the website, despite trying various solutions. Here's what I attempted: I used the following CSS properties: min-height: 100%; max-height: 100%; I included these prope ...

Using HTML Select field to make ajax calls to web services

When working with modals that contain forms to create objects for database storage, there is a Select field included. This is the code snippet for the Select field: <div class="form-group" id=existingUser> <label>Username</label> < ...

Alignment of text to the right in a two-column div design

I'm trying to figure out the most effective way to have a block of text aligned on the left and another block of text aligned on the right within a div. Here is an image that illustrates how I want it to appear Initially, I considered using three se ...

Injecting dynamic data into a function parameter with Angular 1 Interpolation

In my code, I have a feature that alters the text displayed on a button depending on certain conditions. $scope.text = 'Wait'; if(Number($scope.x) == Number($scope.y)) $scope.text = 'Go' else if(Number($scope.x) < Number($scope ...

I am in search of a container that has full height, along with unique footer and content characteristics

I have set up a jsfiddle to demonstrate the scenario I am facing: There is a basic header, content, footer layout. Within the content-container is a messenger that should expand to a maximum of 100% height. Beyond 100% height, it should become scrollable. ...

React and Material UI collaboration causing layout problems

Seeking assistance with implementing React and Material UI in my project. My objective is to create a layout with 3 columns on desktop - one column with a radio button and label inline, and the other two columns containing select menus with option values. ...

Submitting quiz responses through a PHP based form

I am currently facing an issue with integrating forms and a quiz on my website. Individually, both work fine but when combined, they do not function as expected. Specifically, the quiz itself operates correctly, however, it fails to send the results via P ...

Why does the <select> dropdown flash when I select it?

Currently utilizing Angular 1.3 and Bootstrap 3.3.x CSS without the JS functionality. There is also an interesting animated GIF embedded within. <div class="form-group"> <div class="col-lg-3"> <label clas ...

Create space in the bootstrap framework between an image and text

I'm trying to increase the space between the title/description and the icon image in my Bootstrap CSS layout. I attempted adding ms-5 to the div tag, but it didn't have the desired effect. NOTE: Please refrain from suggesting margin-right:5px as ...

Adding a class to unhovered elements with jQuery/JS: a step-by-step guide

I have a variety of elements that are almost working how I want them to. There are four divs in total. Depending on the URL visited, I want a specific div to be fully transparent/active. The next div in line should animate in and out of transparency simul ...

What is the best way to keep the footer at the bottom and make it fixed in Material UI?

import * as React from "react"; import Container from "@mui/material/Container"; import Image from "next/image"; import Link from "@/src/Link"; import Box from "@mui/material/Box"; import Typography from &q ...

Display a Datagrid table featuring numerous column headers across multiple pages using asp.net

Unable to provide more details on the title, please refer to the links below. Using DataGrid (not GridView) in ASP.net with VB code. Current display in my datagrid: view picture1 here, I want it to be like this view picture2 here The goal is to split my ...

The issue of excess space surrounding images while utilizing Bootstrap 3

Hey there, I'm currently working on a website using Bootstrap 3 framework and I've run into a little snag. Whenever I add an image (just a regular one with an img tag), it seems to have some white space on both the left and right sides of the scr ...