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 7908489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:58:06+00:00 2026-06-03T11:58:06+00:00

I have written a html page where i want a header,content,footer. All these three

  • 0

I have written a html page where i want a header,content,footer. All these three portions are enclosed in divs and it looks as below

But i observe that the header div does not occupy the full space which was provided(ie.,height: 50% in CSS)

and the content div (containing table) does not occupy the space available between header and footer divs though a height of 100% is spaecified in CSS

The html written is as follows.Am i missing something .

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Html with divs</title>
<style type="text/css">

h1,h2,h3,h4,h5,h6{
    font-size:100%;
    font-weight:normal;
}
q:before,q:after{
    content:'';
}
abbr,acronym{
    border:0;
}

html{
    height:100%;

}
body{
    font-family:Arial,Verdana,sans-serif;
    font-size:0.75em;
    color:#333;
    width:100%;
    margin:0 auto;
    padding:0px;
}


#header1
{
    background-color: steelblue;
    height: 50%;
}


h1{
    font-family:Calibri, Arial, Verdana, sans-serif;
    font-size:2em;
    width:520px;
}


#content
{
    background-color: orange;
    padding: 5px;
height:100%;

}

#content table
{
width:100%;
}



#footer {
        position:absolute;
        bottom: 0px;
    width: 100%;
        height:70px;
        }
#footer div#navigation {
    background: steelblue;
        height: 70px;
    width: 100%;
}

#footer div#navigation div {
    margin: 0 auto;
    width: 100%;
}

#footer div#navigation div p {
    color: #995870;

        color:white;
        width:100%;
        align:center;
        font-size: 11px;
    margin: 0;
    text-align: center;

}

</style>
</head>
<body>


    <div id="header1">
        <p align="center">Header1</p>
        <p align="center">Header2</p>
        <p align="center">Header3</p>

    </div>

    <div id="content">

                <table bgcolor="#fadd09" align="center" style="color:white">
                    <tr><td>Text1 here</td><td>  <input type="text" name="value1"/></td></tr>
                    <tr><td>Text2 here</td><td>  <input type="text" name="value2"/></td></tr>
                    <tr><td>Text3 here</td><td>  <input type="text" name="value3"/></td></tr>
                    <tr><td>Text4 here</td><td>  <input type="text" name="value4"/></td></tr>
                    <tr><td>Text5 here</td><td>  <input type="text" name="value5"/></td></tr>
                    <tr><td>Text6 here</td><td>  <input type="text" name="value6"/></td></tr>
                    <tr><td>Text7 here</td><td>  <input type="text" name="value7"/></td></tr>
                    <tr><td>Text8 here</td><td>  <input type="text" name="value8"/></td></tr>
                    <tr><td>Text9 here</td><td>  <input type="text" name="value9"/></td></tr>
                    <tr><td>Text10 here</td><td>  <input type="text" name="value10"/></td></tr>

                </table>


    </div>

            <!--Footer-->
        <div id="footer">
            <div id="navigation">
                <p style="color: ivory;font-size: 15px;">footer-head</p>
                <div style="float: inherit">
                    <p>The footer</p>
                    </div>
            </div>
        </div>

</body>
</html>
  • 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-06-03T11:58:07+00:00Added an answer on June 3, 2026 at 11:58 am

    Setting height to 100% on the html and body to will allow you to specify a percentage height on the divs, but there are still a number of problems with your page. I’ve created a simpler example based on your code.

    Explanation:

    • I added a doctype at the top of the page, so that you get a more consistent result between browsers. I’ve added the transitional doctype.

    • Each region is surrounded by a ‘container’ div, which is where the height is specified. The headercontainer is set to 50%, contentcontainer set to 40%, and the footer to 10%. In your code, you had the footer absolutely positioned at the bottom of the page. This seems to work fine, but it was actually chopping/overlapping the bottom of the content div.

    • The container divs all have overflow: auto; set, so that if the page is resized, scrollbars will appear in each section if the content is too long (test it out).

    • The inner divs, ‘header’, ‘content’ and ‘footer’ should contain any page content, so that margins/paddings that occur on elements like p, h1, or anything else for that matter won’t cause your page to become larger than 100% – In your page, you had a ‘p’ element directly within the header1 div, which was causing a white bar to appear at the top of your page (due to the 10px margin at the top of the p element by default).

    Here is the code:

    <!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" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <title>Html with divs</title>
        <style type="text/css">
            * 
            {
                margin: 0px;
                padding: 0px;
            }
    
            html
            {
                height: 100%;
            }
    
            body
            {
                font-family: Arial,Verdana,sans-serif;
                font-size: 1.3em;
                color: #333;
                width: 100%;
                margin: 0 auto;
                padding: 0px;
                height: 100%;
            }
    
            #headercontainer
            {
                background-color: steelblue;
                overflow: auto;
                height: 50%;
            }
    
            #header
            {
                padding: 10px;
            }
    
            #contentcontainer
            {
                background-color: orange;
                overflow: auto;
                height: 40%;
            }
    
            #content
            {
                padding: 10px;
            }
    
            #footercontainer
            {
                width: 100%;
                height: 10%;
                background: steelblue;
                overflow: auto;
            }
    
            #footer
            {
                padding: 10px;
            }
        </style>
    </head>
    <body>
        <div id="headercontainer">
            <div id="header">
                <h1>
                    Header</h1>
            </div>
        </div>
        <div id="contentcontainer">
            <div id="header">
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh
                euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad
                minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
                ex ea commodo consequat.<br />
                Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,
                vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
                dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait
                nulla facilisi.
                <br />
                Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming
                id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est
                usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt
                lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus,
                qui sequitur mutationem consuetudium lectorum.<br />
                Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit
                litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem
                modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
            </div>
        </div>
        <div id="footercontainer">
            <div id="footer">
                <h1>
                    Footer</h1>
            </div>
        </div>
    </body>
    </html>
    

    Hope that helps 🙂

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

Sidebar

Related Questions

I have a page that is written in HTML, I want to add a
I have a written up HTML file using the Google Maps API v3. All
I have an HTML page (written in .NET MVC) that allows a user to
I have written this html, in Firefox, it displayed perfect what I want(the blue
I have already a web site written in Html but I want to add
I have written xml file which contains html tags as element like <component> <input
I have a webpage written in HTML. I have a dropdown list that is
I have written the following regex to match a set of e-mails from HTML
Well, i have written a simple python program that parses HTML with HTMLParser. Here
I have a web application written in pure JavaScript (no pre-generated HTML except for

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.