Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 558705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:09:36+00:00 2026-05-13T12:09:36+00:00

I want to have a div that grows when you add more content in

  • 0

I want to have a div that grows when you add more content in it, has at least the height of the viewport and has a header and a footer sticking to the top and bottom. I came up with the following which works fine in IE7 but doesn’t work in ff3.5.

This is the HTML (add repeated ‘Lots of text
‘ for main_body to grow out of the viewport):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Testing 123</title> 
<link rel="stylesheet" href="css/testing.css">
</head>
<body>
<div id="main_body">
    <div id="header"></div>    
    <div id="content">
    Lots of text<br>
    </div>
    <div id="footer"></div>    
</div>
</body>
<html>

This is the css:

* {
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
    border: none;
    z-index: 10;
    font-family: Arial;
    font-size: 20px;
    text-decoration: none;
    text-align: left;
    }
html, body {
    height: 100%;
    background-color: rgb(255, 255, 255);
    }
#main_body {
    position: relative;
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0px 20px 0px 20px;
    }
#header {
    position: absolute;
    top: 20px;
    left: 0px;
    height: 50px;
    width: 100%;
    background-color: rgb(40, 40, 40);
    }
#content {
    margin: 80px 10px 50px 10px;
    }    
#footer {
    position: absolute;
    bottom: 20px;
    left: 0px;
    height: 20px;
    width: 100%;
    background-color: rgb(40, 40, 40);
    }

I think this should work according to specs. And it does in IE but not in ff3.5. Pleae help.

EDIT:
I found out (thanks to Jeepstone) that it works fine when I change margin to padding in #content.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:09:37+00:00Added an answer on May 13, 2026 at 12:09 pm

    100% height is not straight forward. You need to do something like http://www.xs4all.nl/~peterned/examples/csslayout1.html.

    Incidentally, where you are resetting *, you should look at Eric Meyers CSS Reset http://meyerweb.com/eric/tools/css/reset/ as resetting everything can cause problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to parse a html content that have something like this: <div id=sometext>Lorem<br>
I have a page that has a header, a footer middle section that should
I have a div that has a 'home.jpg' image as background and I want
I want to have a CSS div that has a background image (the full
Explanation: I have a page with a content div that will change height. When
I have a DIV that I want to touch the bottom of the screen
I have a div that I want to toggle between displaying or not when
I have a div that I want when user click on a button slideUp
I have a div set transparent with rgba and want on that div an
I have a floating div that gets displayed, and I want it to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.