Maximized display arrangement using css

I am looking to design a full-screen CSS layout with specific requirements.

<div id="divLeft">LEFT is ok</div>
<div id="divRight">
    <div id="divTop">TOP is ok</div>
    <div id="divCenter">CENTER should have fluid height</div>
    <div id="divBottom">BOTTOM should always be at the bottom</div>
</div>

CSS

html{
     height:100%
}
body{
    height:100%
}
#divLeft{
    float:left;
    width:70px;
    height:100%;
    background:#6c9;
}
#divRight{
   margin-left:70px;
    height:100%;
    background:#999;
    color:#fff;
}
#divTop{
     background:red;
     text-align:right;
}
#divCenter{
      background:blue;
      text-align:center;
}
#divBottom{
  background:green;
  text-align:center;
}  

Check out this jsfiddle for reference

The issue lies with #divCenter (needing fluid height) and #divBottom (required to stay at the bottom of the screen).

Answer โ„–1

One way to tackle this issue is by leveraging the calc() function. Despite its limitations, such as lack of support in older versions of Internet Explorer and poor mobile compatibility, using #divCenter's height as 100% minus the combined height of its siblings (20px + 20px) can help achieve the desired layout. To ensure the footer stays at the bottom, positioning its containing block relatively and then absolutely positioning the footer with bottom: 0; should do the trick.

Check out this example on http://jsfiddle.net/gpwD4/6/.

Answer โ„–2

If you have fixed heights for both #divTop and #divBottom, you can achieve the desired layout by using the following CSS:

#divRight{
   position: relative;
}

#divCenter{
   position: absolute;
   top: (height of #divTop);
   bottom: (height of #divBottom);
   left: 0;
   right: 0;

}
#divBottom{
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
} 

Check out the LIVE DEMO for a visual demonstration.

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

Dynamic sidebar that adheres to the content and is placed alongside it using JavaScript

I am in need of creating a sticky sidebar that will float beside my content column. The purpose of this sidebar is to contain jump links on the page, similar to what can be seen on this page, but with the navigation buttons positioned directly next to the ...

unable to decrease the dimensions of the image within the next/image component

Why won't the image size change? I've attempted to adjust the width and height in the component and also tried styling with className, but no luck. The image only seems to resize when using a regular img tag. Here is my code: function Header() ...

When using inline elements with <br /> inside an inline-block, it displays unpredictable behavior

Why does the code appear differently on Chrome and Firefox (Mac)? What can be done to ensure consistent rendering on both browsers? Chrome https://i.sstatic.net/6Epl1.png Firefox https://i.sstatic.net/wzWtO.png <p style="display:inline-block"> ...

Tips for creating a dynamic menu with animated effects

Check out my fiddle here: http://jsfiddle.net/k3AHM/23/ $(document).scroll(function () { var y = $(this).scrollTop(); if (y > 110) { $('.menu-container').addClass( "fix-menu" ).animate('top', '-3px&a ...

Sometimes, CSS unicode characters may not render correctly and appear as jumbled symbols like "âโ€“¾"

https://i.sstatic.net/eGvzJ.jpg Every now and then, about 1 in every 100 page refreshes, the unicode characters on my page turn into jumbled nonsense (you might need to zoom in to see it clearly). Specifically, the unicode characters are displayed as รข ...

Error in altering element width dimension

For my Bootstrap card project, I have some specific rules in mind: The card should have a minimum width of 250px (card #1 - looks good) If the first line exceeds 250px in length, the card should increase its width without wrapping the line (card #2 - widt ...

ul background transparency only works with absolute positioning if using a Transparent PNG

Encountering a strange issue was the order of the day, as I found myself faced with an unordered list featuring a background image in the form of a semi-transparent PNG. To my surprise, the transparency only became visible once I designated the unordered l ...

The CSS counter fails to increment

In this unique example: h3 { font-size: .9em; counter-reset: section; } h4 { font-size: .7em; counter-reset: subsection; } h3:before { counter-increment: section; content: counter(section)" "; } h4:before { counter-increment: subsection 2; ...

Accordion panel overlapping when you select another one to open, causing the previously opened panel to close

I recently implemented an accordion feature on my website located at . You'll notice that there are two accordion fields named "DONE-FOR-YOU WEBSITE" and "WEEKEND WEBSITE WARRIOR". When you click on these fields, their respective panels open up as int ...

CSS Transition not activating upon initial mouseover

My attempt at a simple transition is not working properly on Safari. I am trying to change background images from A to B on hover, but the transition is not smooth when I first hover over the element. Instead of gradually fading in/out, it instantly change ...

Guide to utilizing the bootstrap grid system to stack below a width of 480px

I have been grappling with this issue, but unfortunately, there seems to be a lack of information on how to resolve it. I have gone through numerous old posts where individuals are "modding" the files and creating their own col-ms (medium-small) that stack ...

Using a personalized font in your RShiny application

I'm interested in integrating a unique custom font into my Rshiny App. I have a feeling that the necessary code should be placed within tags$style, but I am unsure of the exact syntax needed for this integration. Below is an example code snippet: ui ...

Is there a way to design a CSS layout that automatically adjusts text wrapping based on the size of the page and columns?

I am attempting to design a CSS page that mimics the appearance of an aged newspaper. The focus is on ensuring that the page is responsive, with a single column of text on smaller devices. However, the main issue I need help with lies elsewhere. For larg ...

What is the best way to align a circular image using CSS?

Having an issue with positioning a rounded image to the left of a webpage. Despite trying various methods, the image ends up flat with its corners missing and positioned on the right side instead of the intended left. I've scoured the internet for ans ...

Having trouble with displaying the logo on the navigation bar (using bootstrap and django)?

Hello, I am struggling to include a logo in my navbar and it's not being displayed. Despite researching similar queries from others, I still can't figure out why the image won't show up. I'm uncertain whether the issue lies within my co ...

Arranging content within a bounding box

Hello everyone, I'm currently working on creating a webpage layout with a main container that will house all the content. Inside this container, I have an image covering a specific portion of it, a title positioned to the left, and text to the right. ...

Can the inclusion of jQuery on a webpage lead to Selenium CSS selectors malfunctioning when utilizing the contains feature?

Currently, we are utilizing Selenium 1.0.1 for testing our web application by employing css and xpath selectors. In our experience, css selectors tend to be more reliable and function seamlessly in both FireFox and IE. However, on February 24th, a glitch a ...

"Trouble with jQuery: Selecting an image to change isn't

Can someone help me figure out why my simple image change on a dropdown isn't working correctly? You can find the code on this Jsfiddle. Thank you for any assistance! $("#display_avatar").change(function(){ $("img[name=preview]").attr("src", $( ...

Achieve overlapping divs using the Grid Layout

My objective is to have the div overlap the next row(s) without pushing them down when it increases in size. I attempted to use position: absolute; but this caused issues with the Grid Layout structure. Preserving the shape of the grid is crucial to me ...

Tips for setting up unique colored speech bubbles based on user profiles in an Instant Messaging platform

If you were creating a real-time messaging platform that supports group chats with 3 or more users, and each message bubble needed to have a unique color, how would you approach this? Is there a method to dynamically change the CSS class of a speech bubb ...