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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:46:25+00:00 2026-05-26T09:46:25+00:00

I have a wrapper class that contains all the content on the web page.

  • 0

I have a wrapper class that contains all the content on the web page. the problem is if the content is absolutely placed, it eats my footer. I have to place the content as absolute positioned.

It seems like the footer doesnot recognize that the content is absolute. Heres my code

<style>

* {
    margin: 0;
    }
    html, body {
    height: 100%;
    }
    .wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -4em;
    }
    .footer, .push {

    height: 4em;
    }
 </style>
 </head>

<body>
<div class="wrapper">
<img src="activity/Chrysanthemum.jpg" style="z-index: 1; position:absolute; width: 420px; height: 400px; left: 100px;top:260px; ">
<div class="push">
</div>
</div>
<div class="footer" >copyrights</div>
</body>

If I change the image style by removing the position:absolute property , everything looks normal. so my question is how can we place the footer at the bottom with absolute positioned contents?

  • 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-26T09:46:26+00:00Added an answer on May 26, 2026 at 9:46 am

    Updated answer, regarding comment.
    As I mentioned at my previous answer, this effect cannot be achieved using pure CSS. So, I will show the JavaScript approach. Add relevant IDs (see Fiddle), and add the following code at the end of your body. This code snippet will resize your wrapper when necessary.
    Note: When the page is smaller than the window’s height, the page wrapper will still take the full height, because it’s not possible to distinguish a height change by an absolutely positioned element.

    <script>
    (function(){
        var wrapper = document.getElementById("wrapper");
        var height = document.documentElement.scrollHeight;
        wrapper.style.height = height + "px";
    })();
    </script>
    

    Previous answer:
    The issue is caused by the fact that absolutely-positioned elements do not affect the height/width of their parent.

    To fix your code, apply the following CSS (only showing relevant CSS, updated postfixed by descriptive comments). Fiddle: http://jsfiddle.net/4ja2V/

    html, body {
        height: 100%;
        width: 100%;
        padding: 0; /* Get rid off the padding */
    }
    .wrapper {
        position: relative; /* Necessary to properly deal with absolutely positioned
                               child elements. */
        height: 100%;
        margin: 0 auto 4em; /* So that the content is visible when scrolled down*/
    }
    .footer {
        height: 4em;
        position: fixed; /* Positions your footer at a fixed position in the window*/
        bottom: 0; /* At the bottom of the window*/
    }
    

    You were using a negative bottom-margin for .wrapper, which caused the element to “eat” the footer. When you’re using absolutely poisitioned inner elements, there’s no reliable pure-CSS method to get the real width/height of the .wrapper element. Hence the appearance of position:fixed.

    The footer is defined to have a height of 4em. Because the footer is positioned at a fixed position (ie, the element won’t move when scrolling down), it’s necessary to apply an additional margin at the bottom of the wrapper element.

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

Sidebar

Related Questions

I have a wrapper generic class that intended to be used with a set
I have a class 'Database' that works as a wrapper for ADO.net. For instance,
I have a working wrapper class for Dallmeier camera devices, It contains a callback
I have a wrapper element that contains two floated elements the contentArea and sidebar.
In my ASP.NET MVC application, I have a project that contains all the business
I have some page content which contains multiple occurrences of the below line of
I have a C# class library that contains methods that need to be used
I have a class written in c# which is acting as a wrapper around
I have a list wrapper that maintains two Tstringlists and a TClassList I need
I have a main wrapper div that is set 100% width. Inside that i

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.