css troubleshooting problem: div element floating

When resizing the browser, I am aiming to achieve the layout displayed in the second image without encountering the positioning of the first image. http://jsfiddle.net/gtczu/19/

<div id="lft-widget" style=" border:solid red 3px"></div>
<div id="rgt-widget" style=" border:solid blue 3px"></div>
<div id="center-widget" style="border:solid green 1px"></div>
@charset"utf-8";

/* CSS Document */
* {
    margin:0;
    padding:0
}
a, a:hover {
    text-decoration:none;
    border:none
}

body {
    margin:0;
    padding:0;
}
#center-widget {
    position :relative;
    width:300px;
    height:auto;
    float:left;
    padding: 5px 0 15px 30px;
}
#lft-widget {
    width:234px;
    height:auto;
    position:relative;
    float:right;
    padding:25px 25px 0 0px;
}
#rgt-widget {
    width:200px;
    height:auto;
    float:left;
    padding: 2px 22px 72px 30px;
    position:relative;
}

My objective is for when the browser is resized, #center-widget to move to the bottom of #rgt-widget. Although it currently moves accordingly, it initially goes to the bottom of #lft-widget before reaching #rgt-widget. I want it to directly position itself at the bottom of #rgt-widget.

This is my desired outcome.

Achieving this goal while avoiding this specific positioning.

Answer №1

Include these changes

 clear:left;

in the middle-widget stylesheet and it will display below the right-widget section when resizing the window.

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

automatically collapse a submenu once a different menu option is selected

After doing some research and trying out various solutions, I still couldn't get it to work. I made adjustments to my dropdown menu and click function so that each submenu opens and closes when its parent is clicked. However, I'm now looking to f ...

Insert content into a designated DIV

Progress bars are essential for tracking certain metrics. Take a look at the progress bars below: <div id="lifeBar-holder"> <div id="lifeBar"></div> </div> <div id="discretionBar-holder"> <div id="discretionBar"&g ...

Error: Validation issues detected in field functionality

My goal is to loop through a set of text fields and check if the user has input any values. However, I'm facing an issue where even though I have provided values in the text fields, it seems like they are empty. To better illustrate my problem, I have ...

Tips for designing interactive tooltips for images

Are there any alternative methods for adding multiple tooltips on top of an image in a more elegant way, without relying on image maps? Ideally, a solution involving jQuery would be great, but not essential. I am aware that image maps can be used for this ...

Prevent element displacement upon resizing the window in Bootstrap

My latest project involved creating a simple HTML code using HTML, CSS, and Bootstrap. I utilized col-md-4 and col-md-8 to divide a row. However, I noticed that the background image from col-md-8 gets shifted down when I resize the window. Below, I have p ...

Enhancing Material UI List Items with Custom Styling in React.js

My website's navigation bar is created using material-ui components, specifically the ListItem component. To style each item when selected, I added the following CSS code: <List> {routes.map(route => ( <Link to={route.path} key={ro ...

What's preventing vh from functioning in Chrome, yet it's fully operational in Internet Explorer?

Currently, I am utilizing vh for my project, which as far as I know represents 1 percent of the view height of the page. This measurement should function similar to percentages, especially with borders and potentially other elements. However, when I tested ...

Creating a wavy or zigzag border for the <nav id="top"> element in OpenCart version 2.3

I'm trying to achieve a wavy/zigzag border on the <nav id="top"> section in opencart v2.3 instead of a flat border. something similar to this example Below is the CSS code I am currently using: #top { background-color: #EEEEEE; borde ...

Simple method for displaying or hiding divs depending on the status of a selected radio button using CSS only

I am currently working on showing or hiding div elements based on the status of a radio button. These divs are located after the input buttons in a different section of the page, and I am facing challenges in referencing them accurately. This code is for ...

Transitioning the width in CSS without using the "auto"

Currently, I am experiencing a problem with my CSS animation that is leaping directly from the start to finish. It appears to be connected to a similar issue addressed in this thread. My inquiry is: Is there a way to create a smooth transition in width f ...

What is the best way to position text both before and after the alert box is displayed?

Seeking guidance as a newbie in Javascript. I would like to allow the user to input their name into a text box and upon submitting it, display an alert saying "hello" followed by the user's name. The code currently outputs the user's name in an a ...

Is there a way to control the visibility of two divs depending on which one a user hovers on?

Having two stacked div elements containing images, I want the div with id = "features3_HDS_image" to become visible when a user hovers over the div with id = "HDS_Blurb", and the div with id = "features3_FH_image" to be displayed when hovering over the div ...

What is the best way to maximize the use of the space available until reaching a div with varying dimensions each time

I have a div on the left that displays a name, and it can vary in length. On the right, there is another div with buttons. The number of buttons may change, so I am unsure how many will be displayed. Is there a way to utilize only CSS to make sure the fi ...

Styling Iframe Borders with HTML and CSS: A Guide to Custom

Hello there, I am still learning the ropes of HTML and CSS and I have a question regarding styling a div with CSS to look like a default iframe in Internet Explorer. Despite my efforts and searches on Google, I haven't been able to achieve the desired ...

Enhance your web form with the Bootstrap 4 tags input feature that allows users to add tags exclusively

I'm currently utilizing Bootstrap 4 along with Bootstrap Tags Input to create a multiple category selection feature. My goal is to enable users to choose multiple items exclusively from the predefined categories listed in the predefined_list. At pres ...

The jQuery click function triggers immediately upon the loading of the page

Despite my best efforts to resolve this issue independently and conduct extensive research on Google, I am still unable to identify the root of the problem. It seems that the click function continues to activate upon page load. Kindly elucidate the under ...

The foundation grid system is not being implemented

How come my div is not affected by the foundation grid system: render: function(){ var {todos,showCompleted,searchText} = this.state; var filteredTodos = TodoAPI.filterTodos(todos,showCompleted,searchText); return ( <div> ...

The jquery fancybox ajax modal popup fails to display in Internet Explorer 7

Recently, I utilized JQuery fancy box for the first time to display a menu list. When clicking on a specific item, the page is rendered properly in an iframe. However, if there is already an AJAX model popup present on the rendered page, it doesn't di ...

Having trouble with React image rendering using webpack?

Struggling to display an image in my React Web App, I encountered a broken image despite the correct file path appearing in the console log. We're utilizing url-loader and file-loader with webpack, importing the file path directly as necessary. Attemp ...

The Bootstrap toggler is failing to conceal

Currently, I am working on a website utilizing Bootstrap 5. The issue arises with the navbar - it successfully displays the navigation when in a responsive viewport and the toggler icon is clicked. However, upon clicking the toggler icon again, the navigat ...