Full height container with footer

Currently facing an issue with a page I am working on.

Here is a snippet of the code:

<div id="header"> // header..
</div>
<div id="content">  // content where ajax is loaded (should cover at least 100% of the site height)
    <!-- ajax -->
</div>
<div id="footer"> //empty currently.

</div>

Now onto the CSS:

#content{
    margin-left:auto;
    margin-right:auto;
    background-color:#767670;
    width:800px;
    border-left:1px solid #9F9793;
    border-right:1px solid #9F9793;
    position:relative;
    height:auto !important; /* for modern browsers */
    height:100%; /* IE6: treated as min-height*/
    min-height:100%; /* modern browsers */

}
#footer{
    width:100%;
    height:40px;
    border-top:1px solid #9F9793;
    border-bottom:1px solid #9F9793;
    background-color:#767670;
}

Seeking help in making the container span from the header to the footer. Have tried implementing various solutions with no success. Any assistance would be greatly appreciated!

Answer №1

#main-content{
max-height:100%;
}

This means that the main content section will occupy 100% of its parent container, in this scenario, it would be the body element.

Therefore, the code should be:

body{
max-height:100%;
}

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

How can I prevent emailjs from submitting empty fields in an HTML form?

I recently created a form with an onclick event that triggers the submission of the form even if it's empty. Here is an example: <form> <div class="form-item"> <label for="date">Date:</label> ...

Issue with enabling overflow-y: scroll within a Bootstrap Modal

I've implemented a modal using the Bootstrap library that contains multiple lists populated through Ajax search requests. These lists have a fixed size and utilize the CSS property overflow-y: scroll to accommodate a large number of elements without a ...

Uncertainty surrounding the application of class selector within CSS

Currently, I'm deep into my CSS learning journey on Progate.com. I've been cruising through the exercises, but I hit a roadblock when it comes to a specific class selector in the CSS code. The task at hand is simple: I need to tweak the CSS so th ...

Error in Javascript caused by the use of Jquery's "hide on load" feature

Looking for help with creating a menu where the subitems disappear when the page loads. If you require the full HTML code, I can provide it, but essentially it consists of several DIVs, with the items under headers having a class of subitems. I was able ...

What is the best way to alter the background of a div when hovering over an image?

I am looking to achieve a unique effect with my thumbnail image and background. Currently, I have the thumbnail image inside a div with another image serving as the background to frame it. My goal is to change the position of the background image from bott ...

Extract the content from a <Span> element without specifying its ID

Is there a way to make it so that when a user clicks on an HTML tag, the text is copied to their clipboard? I also need to ensure that this functionality does not apply to a specific tag ID/name as I am unable to add those to my span. Is there a way to aut ...

A placeholder within the HTML <code> element

Is there a way to include a placeholder attribute in the < code> < /code> tag similar to the < input> < /input> tag? <input type="text" name="fname" placeholder="First name"><br> ...

Ways to change specific CSS class properties in a unique style

As a Java programmer using primefaces 5.1, I've encountered some challenges with handling CSS classes. One particular issue I'm facing is the need to override certain CSS properties to remove the rounded corners of a DIV element. The rendered cod ...

Issue with Retrieving the Correct Element ID in a Loop with JavaScript Function

I'm in the process of developing a dynamic wages table with HTML and JavaScript to compute each employee's wage based on input from each row. In order to achieve this, I've utilized a loop to assign a unique ID to the total cell in every ro ...

Is there a way to remove a pseudo element in CSS using Internet Explorer

I've been struggling to make some pseudo elements work in Internet Explorer, but it seems like I can't get it to function as intended. It's as if IE is ignoring the CSS rules that I have set up for these elements, and it's quite frustr ...

Guide on importing table information into an array using jQuery

I am facing an issue where I want to extract values from a dynamically generated table and then send those values in an AJAX call. The problem is that even though I am able to increase the number of rows in the table dynamically, when I try to capture the ...

Adjusting the size of the iframe to match the dimensions of the window

Is there a way to make the iframe automatically fill up the entire space? For example, only opens the iframe up to half of the window in Mozilla Firefox and IE6. How can I ensure that it takes the maximum size of the screen? Are there any CSS or JavaScr ...

Bootstrap's versatile footer positioning adaptation

I am working with a simple layout design: +----------+ | Header | +----------+ | | | Content | | | +----------+ | Footer | +----------+ My goal is to ensure that the footer is positioned: at the bottom of the viewport when there ...

Tips for achieving a full div image on hover

I'm having trouble with my CSS code for an image hover effect in a div. The image is appearing larger than the div and leaking out of it. How can I make sure the image stays contained within the div? Here's the updated CSS code: img { display ...

The code written inside the <script> tag seems to be malfunctioning when placed in the component.html file within VScode while working with

I'm facing an issue where the script tag for jQuery included in index.html is not being executed within the component.html. There are no errors detected when inspected. Additionally, I have used another script for a toast message box. <script sr ...

Can anyone lend a hand with styling this menu without relying on margins in CSS?

I've been working on a website and I've noticed a significant lag in Internet Explorer when hovering over the menus. It appears that Cufon is contributing to this issue, especially when applying height, width, margins, or paddings to the li:hover ...

PHP form redirection is a useful feature that allows website developers to

I have created a PHP contact form on WordPress that redirects users based on their selected region. I have used 'www.google.com' as a test URL, but the form is redirecting to the custom theme page I built on WP instead. What am I doing wrong? ...

Scrollbar width does not expand when hovered over

I am having trouble increasing the width of the scrollbar when hovering over it. However, I keep receiving an error in the console stating that 'scrollbar.addEventListener' is not a function. JAVASCRIPT setTimeout(function() { const scrollbar ...

Action outcome yielding identical content

Is there a way in MVC C# to return an ActionResult without making any changes to the view? I have attempted: Returning null and new EmptyResult(), but these result in an empty page Returning an empty JavaScript (again, resulting in an empty page) Retur ...

Containerized chatboxes with improved stability

https://i.sstatic.net/ILwsO.jpg Within the div labeled chatbox-container, there are two chatboxes that have been positioned to float: right with a margin-right: 15px. .chatbox-container { position: fixed; z-index: 1; right: 0; left: 0; ...