Container element refusing to grow in size while the footer remains fixed on the screen

Description: I recently encountered an issue with the layout of my website. I have a main content div (#main) and a container div (.display), which should expand automatically with content to push the footer down. Initially, I struggled to get this working but eventually succeeded. However, after updating my website, I seem to have broken this functionality.

The problem I'm facing now is that while the #main div expands correctly with content, the .display class doesn't. It stops about 100px before the end of the #main div, causing the footer to get stuck in that position. I've tried adjusting the height property of the container in various ways in the CSS, such as setting it to auto or 100%, but nothing seems to make it expand properly.

If anyone has any insights on how to fix this issue, I would greatly appreciate the help! HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>

</head>

<body>
<div class="display">
<div id="header">
<div id="logo">
...
</div>
<div id="navigation">
<ul class="glossymenu">
<li class="current">...<b>Home</b></a></li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
</ul>
</div>
<div id="login" align="center">
...
</div>
</div> <!--END OF HEADER-->



<div id="main">


<div id="intro" align="center">
...
</div>

<div id="interested">
<div id="quote1">
...
</div>

<div id="buttons">
...
</div>

</div>

<div id="homeFeatures">
...
</div>

<div id="homePricing">
...
</div>


</div> 
<!--End of Main-->


<div id="footer">

<div class="footerContent">
<div id="contactUs" class="footerClass">
...
</div>

<div id="community" class="footerClass">
...
</div>

<div id="sitemap" class="footerClass">
...
</div>
<div id="navWrap"> 
<div id="clientScroll"> 
<div id="scroller">
</div> 
</div>
</div>
</div><!--END OF FOOTERCONTENT-->


</div> 
<!--END OF FOOTER DIV-->


</div><!--END OF DISPLAY DIV-->


</body>
</html>

And here is the CSS:

@charset "utf-8";
/* CSS Document */

html, body{height:100%;} 
html,body {margin:0;padding:0}

body,td,th {
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
color: #000;
}
body {
background-color: #FFF;
}

a {
font-size: 14px;
color: #333399;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: bfce24;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
h1 {
font-family: Georgia;
font-size: 40px;
color: #000;
}
h2 {
font-family: Georgia;
font-size: 30px;
color: #000;
}
h3 {
font-family: Georgia;
font-size: 20px;
color: #000;
}

.header
{
background-repeat: no-repeat;
background-color: #f7f7f7;
height: 100px;
width: 100%;

}

.display {
position: absolute; 
left: 0%; 
width: 100%; 
}

#logo
{
position: absolute;
top: 20px;
left: 100px;
}

#navigation
{
position:relative;
top:90px;
}

#main
{
position:relative;
top: 100px;
left: 100px;
width: 1000px;
}

#footer
{
background-color: #5956a9;
background-repeat:no-repeat;
position: relative;
height:250px;
width: 100%;
}

.footerClass
{
font-size:14px;
color:#FFF;
}

.footerClass a
{
font-size: 14px;
color: #FFF;
}


.footerClass a:hover
{
text-decoration: underline;
font-size: 14px;
color: #bfce24;
}


.footerClass a:visited
{
font-size: 14px;
color: #bfce24;
}

.footerClass h1
{
color:#fff;
font-size:24px;
}

#contactUs
{
position:absolute;
left: 10px;
}


#community
{
position:absolute;
left: 800px;
}

#sitemap
{
position:absolute;
top: 170px;
left: 320px;
}

#login
{
position: absolute;
top: 18px;
left: 1000px;
}

#mainFeatures
{
position: relative;
top: 35px;
height:auto;
}

#intro
{
position: relative;
height:auto;
}

#interested
{
position: relative;
width: 1000px;
padding-top: 10px;
}
#quote1
{
position: relative;
float: left;
}

#buttons
{
position: relative;
float: right;
}

#homeFeatures
{
position: relative;
top: 20px;
}

#homePricing
{
position: relative;
padding-top: 20px;
}

Answer №1

Is it intentional that your entire layout is set to be positioned absolute? It seems a bit unusual.

.display {
/*position: relative;
margin-left: auto;
margin-right: auto;
width: 100%;
top: 0px; */
position: absolute; 
left: 0%; 
width: 100%; 
}

Have you thought about using margin instead of top/left positioning for the main section?

#main
{
margin-top: 100px;
margin-left: 100px;
width: 1000px;
}

To see this in action, check out: http://jsfiddle.net/LepXg/3/

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 is the best way for me to make sure the element overflows properly?

How can I make the contents of the <div class="tags> element cause overflow so that one can scroll its contents instead of the element simply extending in height? I've experimented with different combinations of overflow-y: scroll and min- ...

The CSS linear gradients rainbow wheel is missing a few sections, only displaying part of its 12

I've almost got everything working, but I'm facing a challenge in displaying all 12 sections of the rainbow wheel. I know it's probably something very simple (Occam's razor). I've been following this amazing tutorial on CSS linear ...

I would like to automatically log out when closing the tab in Mozilla, Internet Explorer 8.0, or Chrome

Hello there, I was wondering if it's feasible to end the session and log out when I close my tab. I'd appreciate it if you could confirm whether this feature has been implemented on your end. Thank you, Manish ...

The functionality of HTML5 canvas image objects is not functioning as expected

I have been working on a function to retrieve an image object using HTML5 canvas, but I keep encountering an error alert (onerror event) function FetchImage() { var img = new Image(); img.src = "http://localhost/assets/images/loadedsprite.png"; ...

The navigation bar vanishes from sight while scrolling underneath other sections

UPDATE: Problem solved! I discovered that the 'overflow:hidden' inside the #main for the media query was causing the navigation to disappear. I have a scroll navigation positioned at the top of my webpage. However, as I scroll down, the navigati ...

Instructions on designing a three-column layout for six separate div elements

i am having trouble organizing 6 div elements into 3 columns per row. Currently, I have them arranged in two rows, but the issue arises when a column's h2 element is long and it pushes down the column below, creating a large space in the second row. A ...

Modifying Ajax-injected HTML with JQuery's editInPlace functionality

I have been successfully using the JQuery editInPlace plug-in on a static HTML page. However, I am facing an issue when trying to use the same plugin with HTML injected via an Ajax call. I have heard that using .on() like '$('.edit_inplace_fiel ...

Tips on aligning two divs vertically within an HTML <li> element, even with content that varies in size, by utilizing nested flexboxes

Every div contains unique content of varying heights. Our approach involves using flexboxes to ensure equal height for each li element. Now, we are facing a challenge with positioning the div class="2" so that their tops align perfectly. We've expe ...

Building a loading spinner component in a react-native project

I have successfully implemented a loading spinner that is currently being used in various components of my React project. However, as I am now working on a react-native version of the application, I am faced with the challenge of recreating this loading sp ...

What is the best way to activate the cube portfolio using custom jquery?

Is there a way to activate the Cube portfolio filter using custom JQuery? see image here For instance: In my Cube portfolio slider, I have over 20 projects featuring different technologies. When I slide the div, I want the filter to be activated based on ...

The CSS "mask" property is experiencing compatibility issues on Google Chrome

Hey there! I've recently developed a unique progress bar component in React that showcases a stunning gradient background. This effect is achieved by utilizing the CSS mask property. While everything runs smoothly on Firefox, I'm facing a slight ...

Show a specific portion of an extremely large .svg image file using Angular.js directive with the help of javascript or css

Currently, I am facing a challenge with a large map image (3000x8000px) in .png format that I have converted to .svg for data visualization purposes. I am struggling to find a way to display a specific small section of this map.svg file on an HTML page u ...

What is the method for altering the color of the webkit-slider-thumb using JavaScript?

I am looking to adjust the color of an input range using JavaScript instead of CSS. Can someone help me with this request? Current CSS Code: input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; background: goldenrod !importa ...

Encountering a problem with React components displaying incorrect sizes while utilizing flexbox styling

I am creating a basic test application using NextJS/React. Take a look at the code snippet below: The content of Board.tsx file: import './Board.css'; export default function Board() { return <div className="board"> < ...

Can you answer this straightforward query about CSS positioning?

I am currently facing a challenge in creating a small div (header class) that overlays a main banner image div (banner class). When I maximize my browser window, the positioning is correct. However, upon resizing the browser, the header div maintains its m ...

minimize the size of the image within a popup window

I encountered an issue with the react-popup component I am using. When I add an image to the popup, it stretches to full width and length. How can I resize the image? export default () => ( <Popup trigger={<Button className="button" ...

Scraping a website where the page source doesn't match what is displayed on the browser

Imagine I'm interested in extracting marathon running time data from a specific website: Upon inspecting the webpage using Google Chrome, I noticed that the desired data is not directly visible in the page source. Although I have successfully scraped ...

Adjusting the dimensions of the "overflow avatar" to be consistent with the other avatars displayed in AvatarGroup

When setting the max prop of the AvatarGroup, the additional avatar does not match the height of the other avatars. <AvatarGroup max={3}> <Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" sx={{ width: 24, height: 24 ...

Is there a method to make an <img> automatically adjust its width to fit that of its containing <div> even if the style/attributes are

If I'm unable to customize the style, tag, or attributes of an image element, is there a way to make its width adjust to fit a parent division or another container? This situation pertains to an email template, so external stylesheets, <style> ...

The content spills out of the container

I'm currently working with a div that displays scrolling text when it overflows. I am wondering if there is a way to hide the scroll bars until the text actually overflows? Additionally, is there a method to make the overflow occur only vertically and ...