Elements floating and creating gaps (caused by varying heights)

I am working on developing a responsive webpage.

This is what I am aiming to achieve. View jsfiddle

#container {
  max-width:500px;
  width:100%;
  color: #fff;
}
#one {
  width:300px;
  height:200px; 
  background:#66BCD9;
  float:left;
}
#two {
  width:200px;
  height:50px; 
  background:#A1A6E6;
  overflow: hidden;
}
#three {
  width:200px;
  height:50px; 
  background:#E3A1E6;
  overflow: hidden;
}
#four {
  width:300px;
  height:100px; 
  background:#ED5894;
  float:left;
}
#five {
  width:200px;
  height:300px; 
  background:#368736;
  overflow: hidden;
}
#six {
  width:300px;
  height:300px; 
  background:grey;
  overflow:hidden
}
<div id="container">
  <div id="one">#one</div>
  <div id="two">#two</div>
  <div id="three">#three</div>
  <div id="four">#four</div>
  <div id="five">#five</div>
  <div id="six">#six</div>
</div>

For the desktop view, my goal is to have #six reach the bottom of #four.

When the screen size is reduced (mobile view), the divs are in proper order.

How can I ensure that #six touches the bottom of #four in the desktop view?

Answer №1

Overflowing content can be handled in various ways using the overflow property within a block level container. This property allows you to choose whether to clip the content, show scrollbars, or simply display the overflowing content. /* Content is clipped and no scrollbars are shown */ overflow: 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

execute a retrieval query on an html pop-up

I have recently created an HTML web resource that I am displaying when a ribbon button is clicked. Within this popup, there is a dropdown list that I intend to fill with records obtained through a fetchXml query. The issue I'm encountering is that de ...

Issue with Angular: RouterLinkActive fails to work properly with formControlName

I am currently working on a vertical navigation bar that allows the user to navigate to different components. However, I am facing an issue where when I click on a list item, it's supposed to be active but I have to click on it to navigate to the comp ...

Display radio options when clicked upon

I am in the process of creating a set of radio buttons that will be utilized for capturing values to generate a subscription/modal checkout. My current situation involves having the radio button options visible. However, I aim to achieve a functionality wh ...

Is it possible to disregard text formatting in Python when using Selenium?

I am experiencing an issue when trying to compare a name from my name string to a name in a webelement. For instance: Name format in my namestring (scraped from a website): Mcburnie Name in webelement: McBurnie The Xpath matching fails because the webe ...

How to Use jQuery to Detect Audio Position in HTML

Is it possible to use the HTML5 Audio tag with an eventListener or action using Dom/jQuery to trigger an event during playback or at the end? This answer mentions currentTime but lacks examples. Pseudo code provided below. <!DOCTYPE html> <html& ...

issue encountered while attaching css file / css styles not rendering

Here is the css link I am using: <link rel="stylesheet" type="text/html" href="/public/assets/lib/css/style.css" /> Despite trying various solutions such as removing "rel="stylesheet"", changing to "text/html", checking paths, placing it in the pu ...

Customizing the appearance of the dragged element in jQuery UI

Is there a way to modify the color of a draggable list item after it has been dragged? Any assistance is greatly appreciated. $("#DragWordList li").draggable({helper: 'clone'}); ...

Can anyone tell me how to retrieve the value of {{org}} in this situation?

<head> <title>My Unique Page</title> </head> <body> <input type="text" ng-model="selectedOrg" ng-show="!isSuperAdmin" readonly /> <select id="nameOrg" ng-model="selectedOrg" ng-cha ...

Discovering Characters in String using jQuery and Implementing a Personalized Class

Update: To achieve the desired typography, I will need to implement some creative jquery / css techniques. The first step is to create a class called .underlined which will allow me to have complete control over the underline by setting a background imag ...

Tips for aligning a SPAN in a navbar to the center

When attempting to center the middle span, the right span containing buttons shifts downward. I am trying to create a navigation bar with one link on the left, three links in the center, and two buttons on the right. While floating the elements on the left ...

Manipulate DIV elements with jQuery by selecting them based on their class names and then

Is there a way to use jQuery to eliminate all DIVs on a webpage while preserving their content that have the following specific pattern? <div class="ExternalClass85AC900AB26A481DBDC8ADAE7A02F039">....</div> Please note that these DIVs adhere ...

Make the Angular Modal scrollable except for when a specific div is being click dragged

I am working on an Ionic app that uses AngularJS. One issue I encountered is with a modal popup that can sometimes extend beyond the visible area. To address this, we applied overflow: hidden to its CSS class. However, there is a specific functionality i ...

Ways to update the text alongside a slider form with JavaScript

I am currently working on a project using html and js function slide(){ let v= document.getElementById("slide_inner"); document.getElementById("slider").textContent=v.value; } <form id="slider"> <label for="slide_inner"&g ...

Position the li elements within the ul at the bottom

I am trying to align a li element at the bottom of a ul list. +------+ | li1 | | li2 | | li3 | | | | | | | | li4 | +------+ Any suggestions on how to achieve this? MY ATTEMPTED SOLUTION: li4 { position: fixed; bottom: 0; } W ...

Creating a CSS circle spinner with a half moon shape is an innovative way to add a unique touch

Image: Circular spinner rotating along the border rim of other solid circle For more details, please visit: https://codepen.io/sadashivjp/pen/oqqzwg I have created a UI codepen here and welcome any modifications or solutions. The code snippet is provided ...

Is there a way to select multiple items using the same xpath in Python Selenium by clicking on them?

I am facing a challenge with my webpage code. The code snippet below presents a radio button setup: <label data-correct="false"> <input type="radio" ng-model="quizCtrl.state.selectedOptionForCurrentQuestion&quo ...

Invisible Thinglink image revealed upon resizing browser

I am currently repurposing a pre-existing theme that has a drop-down menu showcasing an image. I am attempting to integrate a Thinglink into the content section of this drop-down, but unfortunately, the image does not appear until I adjust the size of the ...

What is the best way to retrieve a PDF file from another website and showcase it on our own site without any redirection?

Is there a way to display a pdf from another website without having to redirect to that site? I'm looking for a solution that involves using the URL directly. ...

Clicking on a React component will result in highlighting

What's the best way to display the selected item after a user clicks on it? <Box py={2}> <Grid container width="330px"> <Grid container direction="column" item xs align="left"> ...

Replacing the CSS Reset with the Universal Selector

I implemented Eric Meyer's Reset to set the font, and then loaded my stylesheet to globally set the font using the universal selector. Even though I loaded the universal selector in my SASS after the reset, the reset is still taking precedence. (Atta ...