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

Can a radio button set be designed in two dimensions?

There are three sets of data (dataX, dataY, dataZ) that need to be assigned unique values out of a selection of three options (valueA, valueB, valueC). Each piece of data should be linked to one value and each value should have only one data associated wit ...

Displaying dynamic content in JavaScript using Galleria module

Hello and thank you for taking the time to check out my question. I've encountered a little issue that I can't seem to solve by myself. I'm hoping someone could lend me a hand. On my website, there is a dynamic field filled with a code from ...

Ways to examine the origin of an image based on the attributes of a React component that I have passed as a prop?

I'm facing an issue where I can't use the component's prop to set the src of an image that I imported from a file path in my component's JavaScript file. I have tried different syntaxes but none seem to be working. Here are the formats ...

Steps to import shared CSS using Styled-components

In my project using react, I've implemented styled-components for styling. One requirement is to have a shared loading background. Here is the code snippet of how I defined it: const loadingAnimation = keyframes` 0% { background-position: 95% 95%; } ...

Ways to prevent Bootstrap column from aligning at the bottom of a row

<div class="row"> <div class="col-lg-10"> <div class="expandable-input-small" id="input_element" contenteditable="true" data-max-length="100"> ...

I find it frustrating that Angular consistently redirects me to the login page every time I attempt to navigate to a different page

I currently have a website with both normal user-accessible pages and an admin dashboard accessible only by admins through ngx-admin. To restrict users from accessing the admin dashboard, I've implemented an auth guard that redirects them to the logi ...

What is the process of securing a directory with a password using Node.js and Express?

I am in the process of creating a basic web server using Node.js and Express. My aim is to host various static files, one of which includes a Unity WebGL game. In order for the game to function properly, numerous assets need to be loaded. I am interested ...

Is it possible to create an index.html page with all the necessary head tags to prevent duplicate code across multiple html pages?

Imagine I am using app.js or a Bootstrap CDN link for all of my HTML pages, but I don't want to include it in every single page individually. Is there a way to create an index.html file that includes this so that all other HTML pages load the head fro ...

Alignment of slider arrows in a CSS carousel with Bootstrap 4.1.1

Is there a way to position the carousel control arrows at the left and right ends of the screen in Bootstrap 4.1.1? I attempted the code below but it didn't yield the desired result. .carousel-control .icon-prev{ left: 5px } .carousel-control .icon ...

There are two separate CSS files linked to the same page, but the browser is only rendering the styles from

I am in the process of developing a new web page where I want to implement my own CSS and incorporate some components from this source: . I'm facing an issue with one of the components, as the browser seems to be applying only the styles from my custo ...

Navigating Parent Menus While Submenus are Expanded in React Using Material-UI

My React application includes a dynamic menu component created with Material-UI (@mui) that supports nested menus and submenus. I'm aiming to achieve a specific behavior where users can access other menus (such as parent menus) while keeping a submenu ...

issues with conditional statement

I'm encountering an issue with the if statement not functioning as expected, and I can't seem to figure out why. The if condition always gets displayed regardless of the input. To troubleshoot, I initially used a temporary code snippet for the co ...

What is the method for displaying the delete icon, a child component located within the Menu Item, upon hovering over it using Material UI CSS syntax?

My goal is to display the delete icon when hovering over a specific menu item that is being mapped using the map function. The desired functionality is for the delete icon to appear on the corresponding menu item when it is hovered over. I attempted to i ...

Validation of forms - Must include one particular word from a given set

I am in the process of utilizing Javascript to validate an input field with the specific formatting requirements outlined below: "WORD1,WORD2" The input must contain a comma separating two words, without any spaces. The first word (WORD1) can be any word ...

Personalize the appearance of dynamically generated DIV elements

This script generates a random number of squares (ranging from 20 to 40) and adds text to each square. The script then calculates the width of each square so that they all fit in a single row. Here is the code snippet: var quantity = Math.floor(Math.ran ...

What is the best way to incorporate new elements into the DOM in order to allow users to share their comments

Can anyone help me with the code below? I have a text box and a comment section, along with a button to add comments. However, I need assistance with adding the posted comment below the comment section. Below is the code snippet: <div id="comments"&g ...

What is the best method to locate and reference a specific string within an HTML document using Python?

My specific need involves two separate html pages. One page consists of hyperlinks while the other contains detailed responses corresponding to those hyperlinks. What I am looking for is, when I click on a hyperlink in the first html page, it should dire ...

JavaScript - Fetch POST request is being terminated - Windows Error 10053

Seeking help for my JavaScript project course. The function is aborting during the fetch process. Chrome is the browser being used to test the project. It was intermittently "sending" before, but now it's not working at all. Had to run the app in Chro ...

Ways to prompt a specific text value to generate varied responses

Whenever I try to input the letter "h", I expect a specific value in return but for some reason, it's not working as intended. Despite my best efforts to troubleshoot the issue, I have been unsuccessful in finding a solution. It's frustrating bec ...

Tips on creating a button that, upon clicking, triggers the download of an Excel file using PHPSpreadsheet

I am trying to figure out how to create a button that, when clicked, will download an Excel file named b1b5.xls with some specified values added. Here is the code I have so far: <html> <head> </head> <body> <center> < ...