Footer will be automatically positioned at the bottom when there is no content, without the need

I am looking for a layout that includes a header, content, and footer.

My specific requirements include...

The footer Div should always be positioned at the bottom of the page, even if there is no content in the content Div.

When the content within the content Div expands, I want the entire body (including the header and footer) to expand accordingly.

I do not want to use position:fixed for the footer Div....

I have already experimented with some code in my project......

CSS:

             body
            {
                height:100%;
                margin-left: 0;
                margin-top: 0;
                padding:0;
                width:100%;
                position: relative;
                display:block;
            }
            .container
            {
                display:table;
                width:100%;
                height:100%;
            }
            .header
            {
                top:0px;
                height:75px;
                width:100%;
            }
            .content
            {
                width:100%;
                height:auto;
                position: relative;
            }
            .footer
            {
                top:5px;
                bottom:0px;
                height:45px;
                overflow:hidden;
                width:100%;
            }

CODE:

<div>
  <div class="header">
      Header Div
  </div>

  <div class="content">
      Content Div
  </div>

  <div class="footer">
      Footer Div(Need it,default at bottom position)
  </div>
</div>

Any suggestions?

Note: I need this code to be compatible with IE as well......

Answer №1

To enhance the appearance of your website, include the specified style in either the body tag or the content div:

    div {
       min-height: 500px;
       height:auto !important;
       height: 500px;
   }

This code is effective because Internet Explorer interprets "height" as it should interpret "min-height."

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

Incorporate custom SVG icons from local sources into the project

Having an issue rendering an SVG on the screen using CSS. File structure is as follows: Root > Assets > Icon > user-icon.svg. Attempting to add it using CSS like this: .user-element { background-image: url(/assets/icons/user-icon.svg); } The S ...

Preserve line breaks within HTML text

Utilizing the powerful combination of Angular 5 and Firebase, I have successfully implemented a feature to store and retrieve movie review information. However, an interesting issue arises when it comes to line breaks in the reviews. While creating and edi ...

404 error occurs when Spring-Boot fails to include CSS file through ResourceLocations

My spring-boot application is currently running smoothly on a local computer, but I have encountered an issue. When I run mvn package, none of my CSS or JavaScript files located in /src/main/wepapp/css are included in the jar file created in the target d ...

Learn how to efficiently redirect users without losing any valuable data after they sign up using localStorage

I am currently facing an issue with my sign up form. Whenever a user creates an account, I use localStorage to save the form values. However, if the user is redirected to another page after hitting the submit button, only the last user's data is saved ...

When two div tags are set to float and add up to 100% width, the second div will be forced

New to the world of coding. I am faced with a dilemma involving two div tags, one with 80% width and the other with 20%. Despite totaling up to 100%, the second div insists on moving to the next line. The goal is to utilize the full line while keeping bo ...

Using Jquery and CSS to create a sleek animation for opening a div box container

Designed an animation to reveal a div container box, but it did not meet the desired criteria. Expectations: Initiate animation horizontally from 0% to 100%. Then expand vertically to 100% height. The horizontal animation from 0% to 100% is not visible ...

Is there a way to dynamically apply CSS to a modal?

I have been busy creating a modal, and I wanted to share the HTML code with you. Take a look at the style tag, where I am customizing the .modal-content CSS class and .modal-dialog CSS class. <script type="text/ng-template" id="Data.html"> <styl ...

AngularJS: Example of a table representation with 3 levels of nested ng-repeat

My code includes multiple ng-repeats like shown below: <table class="table table-striped table-bordered" border=1> <tbody ng-repeat="list in globalList"> <tr ng-repeat="child in list"> <td ng-repeat="baby in child"> ...

Looking for assistance with creating a responsive design that works seamlessly on all large devices

Our UI/IX designer has provided a design that I need to replicate. https://i.sstatic.net/8nXym.png I am facing difficulties in centering the circular part of the image. (The vertical line and circular part are separate images) I experimented with using ...

Storing various duplicates of items in local storage

Looking for help with storage settings in HTML/JavaScript as I work on a mobile not taking app using Phonegap. My goal is to allow users to input a note name and content, save them into a jquery mobile list, and see them on the home screen. However, I&apos ...

Displaying HTML content using Typescript

As a newcomer to typescript, I have a question regarding displaying HTML using typescript. Below is the HTML code snippet: <div itemprop="copy-paste-block"> <ul> <li><span style="font-size:11pt;"><span style="font-family ...

Create a pagination system in CodeIgniter for displaying data

Having trouble implementing paging in the search functionality of my result table. I want to display just 10 rows but can't get it to work properly. I tried reading about Pagination on https://codeigniter.com/, but I'm still struggling to unders ...

Position text beneath a collection of visuals

I've been working on a page layout where I have a menu with images aligned in a ul. However, when I try to add text under each image, the text ends up misaligned all the way to the right of the menu. I'm considering starting from scratch without ...

Exploring Javascript parameters with the power of jquery

Is it possible to pass a parameter from PHP into a JavaScript function within HTML? I am currently facing an issue where my code crashes when it reaches a certain condition. This is the code snippet causing the problem: $str="<input type='submit&a ...

There seems to be an issue with the fixed navigation menu in Bootstrap 4. I seem to be overlooking something that is causing this problem

I encountered an issue with my fixed navigation while using bootstrap 4. Everything works fine when hovering over non-active nav items, but it displays two bottom borders when hovering over the active nav item. I'm seeking assistance to resolve this i ...

Classes that are designed to be written on a single

A fellow team member recently made an addition to our project. <ol class="numbered-list list-inside" start="1"> .numbered-list { list-style-type: decimal; } .list-inside { list-style-position: inside; } Is there a problem with this code, ...

What is the best method for incorporating various fonts in CSS?

Despite being new to the world of coding, I have been exploring ways to enhance the typography on my website. A tutorial I found on W3Schools touches on the usage of CSS for incorporating different font styles across my webpages. Among other things, it exp ...

JQuery Submission with Multiple Forms

Hey everyone! I have a jQuery form with multiple fieldsets that switch between each other using jQuery. Eventually, it leads to a submit button. Can someone assist me by editing my jfiddle or providing code on how I can submit this data using JavaScript, j ...

Preventing automatic image adjustment in CSS during zooming in or out

<div class="footer"> <img class="fisk" src="fisk1.jpg" alt="fisk"> </div> I am facing an issue with keeping the size of an image constant when zooming in and out. Despite trying various methods, I have not been successful in achieving ...

Why do my cards keep shrinking instead of moving to a new column when using flexbox and flex-flow?

I'm facing an issue with my flexbox that is causing my items to constantly shrink instead of moving to a new row. I've tried various solutions but nothing seems to work. I have removed the CSS for elements like headers that I believe are unrelate ...