Arranging Footer Sections with CSS Stack

Seeking guidance on achieving a specific stacking order within a flex container. I have a simple footer divided into 3 sections - left and right divs with 100% height and 20% width each. The middle section should flex to fill the remaining space, but it needs to be split vertically in half with top and bottom divs at 50% height each. I'm struggling to determine the proper positioning using absolute, fixed, etc. or floating elements.

Apologies for the confusion, here is the CSS code inside the flex container:

.footer_left_box {
    position: absolute;
    display: inline-block;
    float: left;
    left: 0;
    width: 10%;
    height: 100%;
    background-color: #C9D329;
}
.footer_middle_top_box {
    position: relative;
    display: inline-block;
    width: 80%;
    height: 50%;
    background-color: #2BB851;
}
.footer_middle_bottom_box {
    position: relative;
    display: inline-block;
    width: 80%;
    height: 50%;
    background-color: #3954D4;
}
.footer_right_box {
    position: absolute;
    right: 0;
    width: 10%;
    height: 100%;
    background-color: #E33538;
}

This serves as a reference for the desired layout.

Answer №1

Utilizing Flexbox is an option, but you may have to modify the layout.

footer {
  height: 150px;
  display: flex;
}
.left,
.right {
  flex: 0 0 20%;
}
.left {
  background: rebeccapurple;
}
.right {
  background: #bada55;
}
.middle {
  flex: 1;
  border: 2px solid red;
  display: flex;
  flex-direction: column;
}
.top {
  flex: 0 0 50%;
  background: #c0c0ae;
}
.bottom {
  flex: 0 0 50%;
  background: #c0ffee;
}
<footer>
  <div class="left"></div>
  <div class="middle">
    <div class="top"></div>
    <div class="bottom"></div>
  </div>
  <div class="right"></div>
</footer>

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

The validation error is displayed within the textbox instead of beside the label

Hey there! I encountered a rather peculiar issue while working on my jQuery mobile webapp. I decided to implement jqueryvalidation for form validation, which is pretty neat, except for one hiccup - the error messages are showing up inside the input field ...

The automatic sliding feature stops functioning once the controls have been clicked

When using the boxslider, the autosliding feature functions correctly initially. However, after manually clicking on the left and right arrow controls, the auto sliding stops working. See below for my code snippet: <ul id="slider-assocoates"> ...

Rules not being applied to styled components due to emotional influence

I'm attempting to utilize the emotion library. Here is my JavaScript code: import React from 'react'; import { css } from '@emotion/core'; export const Menu = () => ( <> <nav css={css` position: ...

Tips for maintaining the webcam video in the center of the screen even when the height is set to 100% and the window is being resized

When using React, I encountered an issue with centering a webcam video while maintaining its height at 100% of the screen. Although the video fills the screen vertically correctly, adjusting the width of the window causes the video to lose its centered pos ...

Preventing checkbox selection with CSS

Can CSS be used to deactivate clicks on checkboxes while still maintaining their functionality for dynamically setting values using Javascript? I have not been able to find a suitable solution. pointer-events:none Unfortunately, this did not work as expe ...

Unable to play GSM extension files on a web browser due to compatibility issues

I've been attempting to play an audio file with a (.gsm) extension using <audio>, object tags, and JavaScript. <script> var myAudio = new Audio(); // creating the audio object myAudio.src = "test.gsm"; // assigning the audio file t ...

Dynamically obtaining the screen width in JSP using a variable

Could someone provide assistance on how to resize an image using an img src="blah.jpg?width=x" so that my page can be displayed at various sizes? I just need x (width) as a JSP variable. Update 2021: It's been 9 years since this question wa ...

Tips for enabling auto-scroll feature in MuiList

Currently, I am working on a chat window component that utilizes Material UI for styling. I expected that setting a height or max-height on either the MuiList or MuiBox encapsulating the list would automatically scroll to the new message when it's sen ...

Differentiate among comparable values through placement regex

I'm currently tackling a challenge involving regex as I work on breaking down shorthand CSS code for the font property. Here is my progress thus far: var style = decl.val.match(/\s*(?:\s*(normal|italic|oblique)){1}/i); style = style ? style ...

Attempting to align images in Bootstrap image carousel within a Google Sites webpage

Click here for image of issue I am currently working on adjusting the code to ensure that all six images in this Bootstrap Carousel are centered on my updated Google Sites webpage, as opposed to them appearing at the top like shown in the screenshot. Any ...

Tips for aligning two canvases with different heights at the top in HTML5

My problem involves two canvases housed within a single <div>. Despite their different heights, they are currently aligned at the bottom. +-------+ + + +-------+ + + + + + + +-------+ +-------+ Is the ...

Having trouble with CSS Overflow:hidden not functioning properly on my slider

I have successfully created a 100% width slide using jQuery. However, I am facing an issue where the horizontal overflow is not being hidden. Here are my codes: HTML, <div class="slide"> <ul> <li><img src="inc/imj/slide/1 ...

Golang template's nested ranges

Being fairly new to this, I could use a little assistance. I have these two structs: type School struct { ID string Name string Students []Student } type Student struct { ID string Name string } M ...

Retrieve nodes that are children of another node

Here is the code snippet that I am working with: <div id="page1-div" style="position:relative;width:1347px;height:1189px;"> <img width="1347" height="1189" src="target001.png" alt="bac ...

What could be causing my divs to overlap one another?

I can't seem to get these divs to stack properly, they keep overlapping. I've tried removing the float and checking every attribute in the code. I'm not sure where I'm going wrong. The structure of the rest of the page is similar, but ...

Upon the initial loading of the page, the text appears aligned to the left side of the

Currently experiencing an issue where the text on my website appears aligned to the left upon initial page load. However, upon refreshing or revisiting the page in the same tab, everything displays correctly. The problem seems to be linked to a delay in l ...

How do I send a jQuery table object to a web worker using Javascript?

I have an HTML table with various columns and rows that can be edited by users directly. Whenever a user makes changes to the table, I need to calculate certain sums on the rows of the table. Initially, the function responsible for calculating these sums ...

Endless cycle of invoking functions in Angular.js

Issue with the template : <div class="container"> <h1>Process Definitions</h1> <table class="table table-stripped" > <tr> <td><strong>Name</strong></td> <td><strong>Id</st ...

Semi-transparent HTML5 Canvas illustrations

Can I generate partially transparent elements dynamically in canvas? I am currently adjusting the opacity of the entire canvas element through CSS, but I need certain elements to be more translucent than others. My research has not turned up any evidence ...

Tips for sending <p> data to a router function with HTML

I am currently working on a page where users are presented with a list of unverified accounts, each containing its own form element. Each form has a "submit" button that triggers a POST call to /verify. However, I am facing an issue where the data within t ...