struggling to make the float clear function properly

Having trouble clearing floats on my left-container and right-container using a div, but it's not working as expected.

Both the left and right container are dynamically populated with Jquery after the document is loaded.

Any suggestions on how to resolve this issue?

CSS

#container{
   height:75%;
   background-color:white
}
#left-container{
   height:100px;
   width:23%;
   float:left;
   border-right:1px #254117;
}
#right-container{
   height:100px;
   width:76%;
   float:left;

}

HTML

<div id="container">
   <div id="left-container">
    {% include "leftcontainer.html" %}
   </div>
   <div id="right-container">
        {% block right-container %}
        {% endblock %}
   </div>
   <div id="float-container" style="clear: both;overflow:hidden"></div>
</div>

Answer №1

When setting the height of floated elements to height: 100px, it can lead to an overflow condition in the right container due to most of the content triggering this issue.

There are two possible outcomes:

In the first scenario, if the #container has a sufficient height of 75% to contain the overflowing content, then no clearing is required as the inflow content will start below the bottom edge of #container.

However, in the second case where the #container is too short to hold the overflowing content, the inflow content still begins at the parent container's bottom edge while the overflowing content from the right floated child may overlap.

To see a demonstration, visit: http://jsfiddle.net/audetwebdesign/uddt9/

This situation can be resolved by adjusting the layout according to your preference. (The use of a 100px height may add confusion, so clarity is essential.)

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

Custom stylesheet for individual users?

On my website, users can pick a template for their webpage. After selecting a template, I would like them to have the ability to customize certain styles like the font color. Is there a way to achieve this? I was thinking about saving the user's cus ...

Unable to load circles on page refresh with amCharts Maps

I am experiencing an issue with the functionality of my amCharts maps. Whenever I refresh the page, the circles that are supposed to be displayed disappear. However, when I zoom in, the circles reappear. This problem has me puzzled, and I'm not sure ...

jquery prepend function working in every browser except for Internet Explorer version 7

Oh no! I'm encountering an issue with my website that seems to be browser-specific. Everything is working smoothly in Firefox, Safari, Chrome, and IE8, but not in IE7 (I haven't tested in IE6 or other browsers). It appears that the problem may be ...

Google Chrome Glitch

Greetings everyone, I am a newcomer to this community and not a coder, but rather the project manager for our upcoming summer 2017 release. Our developers and coders have been unable to identify the cause of the flickering issue that is specific to Chrome ...

Changing a variable in an HTML file using a JavaScript file

I am working with JavaScript code that has been imported from another file containing a variable that I need to update in my HTML file. Is there a way to update the variable without directly inserting the JavaScript code into my HTML document? JavaScript ...

Creating two divs with equal heights in React using Material-UI at 50% each

I am currently utilizing a Material UI template within a react JS project. My goal is to create a div (or Grid in MUI) that spans 100% of its container's height, containing two nested divs (or Grids) that are each set at 50% height. If the internal c ...

Trouble with AJAX functionality triggering on page load but failing to work on button click

After experimenting with ajax for some time to retrieve data from a database, I finally managed to get it working in my test file. Encouraged by this success, I proceeded to copy the code into my main file. Initially, everything seemed to be functioning co ...

Exception thrown by the 'upload' method of the Krajee file-input widget

I have been using the fileinput widget from Krajee at this link: However, I seem to be encountering an issue with the 'upload' method. Everything works perfectly fine when I upload files by clicking the upload button. But when I try to use the u ...

Send a single piece of data using AJAX in Flask

I have a very basic HTML form containing only one <input type='text'> field for entering an email address. I am trying to send this value back to a Python script using AJAX, but I am having trouble receiving it on the other end. Is there a ...

Angular is having trouble properly rendering the Array Description

I'm currently working on a project using .net core MVC with an Angular frontend. I am facing an issue where the description of parameter arrays is not displayed in the output, even though single parameters display correctly. How can I resolve this pro ...

Why is my output getting mixed up with the header on the navigation bar page?

output capture image https://i.sstatic.net/BYJnk.jpg here is the code snippet //ui.r library(shiny) navbarPage(theme = "style.css",img(src="logo.jpeg", width="300px"), tabPanel("Dashboard"), tabPanel("Products"), tags$head( t ...

Is it possible to adjust the position of a h2 heading on a particular webpage using CSS?

There is a situation where multiple pages contain h elements nested inside a standard container div class. When trying to edit a specific h2 element in a specific page using CSS, simply editing the h2 or the container does not work. Other methods attempte ...

Overlapping columns with bootstrap images

Struggling to make three images responsive using Bootstrap columns. While they appear responsive, the issue is that the images overlap, except for the last column which displays correctly. <div class="row"> <div class="col-sm-2 offset-sm-3" ...

Automatically choose options based on the value of the textbox ng-model when the page loads using Angular

Here is the design of my select element: <select onchange="getVideo()" id="region"> <option ng-repeat="items in region" ng-selected = "items.countryCode === selectedRegion" value="{{items.countryCode}}">{{items.countryItem}}</option> ...

Error message: When the mouse hovers over, display the chart(.js) results in TypeError: t is

I encountered a persistent error that I just can't seem to resolve. My goal is to showcase a chart using Chart.js when the mouse hovers over the canvas. However, upon hovering over the canvas, I keep getting a TypeError: t is null error. Error: { ...

Using Symfony to handle JQuery responses in HTML is a powerful combination

JSON {"results":[{"id":"1","text":"LogiLink USB Sync-und oplaadkabel iPod und iPhone 0,15m"},{"id":"2","text":"LogiLink USB-HUB 13-Port m. Netzteil zwart kunsstof"}]} JS <script> $('.js-data-example-ajax').select2({ ...

Obtain the current date and time from the server and transfer it to the client machine

With a setup consisting of 4-5 client machines and one server, I am looking to retrieve the date and time from the server only, excluding the clients' date and time. While DateTime.Now in c# and var date= new Date() in jQuery can be utilized to get th ...

The printer is malfunctioning

My webpage has a div that includes various input fields with values assigned using jQuery. I wanted to print the contents of this div, so I found some code online to help me achieve this. However, when I try to print, the values in the input fields end up ...

Image source not functioning properly

I am attempting to dynamically load an image and HTML using Angular but it doesn't seem to be working. Here is what I have tried: <img ng-src="img/{{product.Category}}/{{product.id}}.jpg"> and also this: <img src="img/{{product.Category}}/ ...

Iconic Side Navigation with collapsed button malfunctioning due to negative positioning

I'm facing two issues with my webpage. First: I have three buttons on the right side of my page that are supposed to behave like the buttons on this example. However, when you scroll, you can see that their position is incorrectly displayed "outside" ...