Elements are staying in place on resize of the window

I need assistance with moving the position of div's upon window resizing. In a container, I have three nested div's.

For example:

<div id="container">
    <div class="left"></div>
    <div class="middle"></div>
    <div class="right"></div>
</div>

Although they are currently aligned correctly, I am looking to make these div's responsive and move in relation to the window size (without overlapping).

Here is an overview of my CSS styling:
#container {
    text-align: center;
    width: 100%;
}

.left {
    float: left;
}

.center {
    display: inline-block;
    margin: 0 auto;
}

.right {
    float: right;
}

Your help is greatly appreciated!

This is a quote.

Answer №1

With Twitter Bootstrap, you have the freedom to create your own unique divs and customize your CSS design to your liking. This powerful service also offers automatic responsive layout creation for added convenience.

Explore Twitter Bootstrap

Answer №2

Your styling needs some adjustments. Instead of referencing elements with IDs like #left, #center, #right, try using classes such as .left, .center, .right

Using the # symbol in CSS selects elements by their ID, which is why your current CSS only targets the <div id="container">. Since your other elements have classes assigned to them, use the . symbol instead

Here's an example: http://jsfiddle.net/rELXZ/

For more information on CSS Selectors, check out this resource: http://www.w3schools.com/cssref/css_selectors.asp

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

What purpose does the additional symbol "$()" serve in the selector "$($())"?

Currently, I am looking to incorporate a jQuery scrollspy feature into one of my ongoing projects. Upon coming across this jsfiddle (https://jsfiddle.net/mekwall/up4nu/), I successfully integrated it into my project. However, I have hit a roadblock while ...

Is it possible to apply Border Radius exclusively to round the top of a div?

When applying the border-radius property on a div element with borders, it only affects the top corners. But why is that? For example, you can check out this demo: https://jsfiddle.net/07tqbo56/1/ .asd { margin-top: 35px; ...

Achieving Title Alignment in PDF Export with Balkan OrgChartJS

function preview() { /*centerElement();*/ let fileNameWithTitle = MyTitle.replace(/\s+/g, '_'); let PdfTitle = "<center>" + MyTitle + "</center>"; OrgChart.pdfPrevUI.show(chart, { forma ...

Show a 1920x1170 / 183KB image as the background using CSS styling

I need help with displaying a background image that is 1920x1170 pixels and has a file size of 183KB. Here is the code I am using: .bground{ height:auto; left:0; position:fixed; top:0; width:100%; } <div class="bgrou ...

What is the best way to update the div id by extracting the last digits from a number?

Is there a way to change the div ids using a function? Before: <div id="a_1">a1</div> <div id="b_1">b1</div> <div id="c_1">c1</div> <div id="d_1">d1</div> <button onclick="change()">Change</button& ...

Guide: Implementing Bulma Button Styles in React Components

Looking to integrate a Filter Buttons component into a To Do List Application. Specifically, I want to add four buttons for filtering tasks (All, Active, Completed, Important). Can someone guide me on how to incorporate Bulma CSS Rules with this react comp ...

Switch between webpage design for different devices (mobile/desktop) using javascript, jquery, and bootstrap

I am currently working on a webpage that contains various html elements with bootstrap classes applied to them. <div class="col-xs-12 col-lg-4"></div> My goal is to implement a button that, when clicked, will toggle the viewport/layout change ...

What methods are recommended for expanding the size of a select/dropdown menu?

Managing a long list of values can be challenging, especially when it continues to grow. Consider the following example: <select> <option value="1">1, some test</option> <option value="2">2, some text</option> <optio ...

Linking JSON information to an HTML document

I'm struggling to integrate some JSON data into an HTML page using "Vanilla Javascript," but I'm unsure of how to proceed. Can you please provide assistance? I can share the HTML, CSS code, and an example of the JSON data I want to incorporate in ...

The Vue component that was added dynamically is failing to render

When I have a section of HTML with Vue components inside it, coming from a server, and then insert it on the page by clicking a button, the components are not rendering or showing up. Here is the HTML that gets inserted when the button is clicked: <sec ...

Using AJAX to post button values

I have encountered an issue while attempting to post a value to a PHP script using the POST method in AJAX. The error message is as follows: Notice: Undefined index: gamekey Here is the JavaScript code I am working with: function adminchat(row) { ...

A Guide to Configuring jQuery UI Slider with Three Distinct Colors

I'm currently implementing the UI Slider on my website. However, I would like to customize the slider with three different colors: Handle Color Previous portion of Handle Next portion of Handle I want it to look something like this: Currently, I h ...

Mobile Apps Plagued by Frozen Preloader Gif Images

Working with jQueryMobile(1.3.1) and Phonegap(2.7.0) for developing Android and iPhone applications has presented me with a challenge regarding the Preloader Image. I am currently using a Gif image as my preloader. The custom function I am using for the p ...

Are THREE.js CSS2D Text Labels able to be detected and distinguished by RayCasting?

Currently, I am in the process of creating a diagramming tool using THREE.js. To add text labels to my diagrams, I have been utilizing the CSS2D feature provided by THREE.js, which allows for text that is both rotatable and MathJax-friendly. For regular m ...

Shifting elements within a modal using AngularJS and CSS: Swapping one div out for another

I am currently developing an application and I am considering using AngularJs for this purpose: <div class="main"> <div class="one">Content 1 goes here ...</div> <div class="two">Content 2 goes here ...</div> </div> Wi ...

The process of making an image fill an entire div using Html and CSS

What is the best way to make an image fill an entire div using Html and CSS? ...

Can the text color in Grid View columns be customized according to the search item entered?

Please note: The need for changes in various columns will depend on the search request. ...

Iterating through div elements with JQuery to construct a multiline string utilizing the information stored in a data attribute

Two questions are on my mind: 1.) Looking at my code, I have several divs with onclick events linked to the "callout panel notes" div. When this div is clicked, it accesses the data-category attribute using $(this).parent().parent().siblings().first().dat ...

Header stabilization on scroll

On my webpage, I have a table header positioned in the middle of the page. However, due to the length of the page, I am looking for a way to make the header stay fixed at the top of the browser as the user scrolls down. My query is: Is there a method to k ...

Receiving a BAD REQUEST error when trying to retrieve the address, resulting in an empty string being returned

views.py: from django.shortcuts import render from geopy.geocoders import Nominatim from django.http import JsonResponse Create your views here. def single_address(request): if request.method == 'POST': #print(request) addres ...