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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:22:41+00:00 2026-06-09T16:22:41+00:00

Could someone please help me position my footer correctly in my webpage? I have

  • 0

Could someone please help me position my footer correctly in my webpage?

I have the following layout:

enter image description here

This is how I want the footer to behave:

  • The footer should be positioned at the bottom of the page when the content is empty.
  • The footer should be ‘pushed’ down when the content exceeds the height of the page.

here is my HTML:

<html>
    <head>
        <title>@ViewBag.Title</title>
    </head>

<body>

/* This is outside of the container as I want the background 
   to stretch across the top of the webpage */
<div id="menu">
    <div>
       /* This contains an unordered list which is restyled as a series of links.
          The reason it is contained in inside the menu div is because I want this
          content to be centred. /*
    </div>
</div>

<div id="page-container">

        <div id="header">
            <h1>Website title</h1>
        </div>

        /* This is floated to the left of the content area. */
        <div id="content">
            @RenderBody()
        </div>

         /* This is floated to the right of the content area. */
        <div id="sidebar">
            @RenderSection("sidebar", false)
        </div>

</div>

<div id="footer">
    My footer content goes here.
</div>

Please note the following:

  • The content and header is contained in a ‘Div’ called ‘page-container’.
  • The content is made up of two Divs which are floated to the left and right of the content area.
  • The menu is outside of the page-container div. This is because I want the menu background to stretch across the top of the page (like the Stackoverflow menu)

I am aware that there are many similar questions on Stackoverflow and that a Google search will return a large amount of results.

The thing I have noticed whilst trying to adapt the samples I have found is that they usually depend on a very specific html structure (E.G. everything but the footer is in a container) that does not match mine. No matter what I try I end up with something that doesn’t work (E.G. the footer is positioned below the screen bounds when the content is empty or is not moved down when the content exceeds the page).

Update

I can get my footer to stick to the bottom of the page but it is not pushed down when my content expands. I think this is because my content is made up of two floating elements.

Most people seem to be pointing me to tutorials they have found on Google (as already stated I have read most of these and already attempted to adapt them).

I have come to the conclusion that I am going to have to restructure my HTML to get this to work; the point of my question was how do I do this with the HTML I already have? So much for separation of concerns!

  • 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-09T16:22:42+00:00Added an answer on June 9, 2026 at 4:22 pm

    As mentioned in the edit to my post, I ended up having to alter my HTML slightly:

    <body>
        <div id="page-container" >
            <div id="menu">
                <div>
    
                </div>
            </div>
    
            <div id="layout-container">
    
                <div id="header">
                    <h1>Website title</h1>
                </div>
    
                <div id="content">
                    @RenderBody()
                </div>
    
                <div id="sidebar">
                    @RenderSection("sidebar", false)
                </div>
    
            </div>
        </div>
    
    <div id="footer">
    
    </div>
    

    My CSS is based on CSS found here (This same link was posted by a couple of people but I was already using this anyway!)

    The solution is about 99% effective. My footer sticks to the bottom of my page when the content area is empty and is also pushed down when the content grows larger than the screen but I now have a permanent scrollbar as my page height seems to be off (moving the mouse-wheel scrolls the page up and down by a single pixel).

    I have so far been unable to get rid of this so I am begrudgingly accepting this as a complete solution unless anyone else can point me in the right direction.

    Update

    It seems the 1 pixel offset was caused by my footer having a 1 pixel top border. I simply adjusted my CSS to account for this and the scrollbar disappears when the content does not completely fill the screen.

    #footer {
        margin-top: -151px;
        height: 150px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please help me out with the following problem in java. I have
I was wondering if someone could help me please. I have the following two
Could someone please help me to convert this String into a Map ... String
Could someone please help me in here, I'm just a beginner who want to
Could someone please help explain why I can't get this to work? I properly
Could someone please help me with the following problem: There are two classes MainForm
Could someone please help me with this? I need to convert an nchar column
Could someone please help solve this problem?
I was wondering could someone please help me implemenrt this method whereas I dont
Could someone please help me to understand why the following block of code keeps

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.