A design featuring two columns and a fixed footer

I'm struggling to make my 2-column layout display properly with a footer that sticks to the bottom of the page. Despite following all the usual advice, my columns keep expanding beyond their container div, which causes the footer to get pushed off the bottom of the page.

My latest attempt was to treat the columns container as a table!!

<!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">
    <head>
        <style>
            html, body{
                margin:0;
                height: 100%;
                padding: 0;
                border: 0;
                overflow:inherit; /* triggers 100% height in Opera 9.5 */   
                font-family: proxima-nova, 'Proxima Nova', gotham, 'helvetica neue', helvetica, arial, sans-serif, sans;
            }

            body{  
                background-color: burlywood;
            }

            #wrapper
            {
                background-color: #FFFFFF;
                min-height:100%; 
                width: 980px;
                margin:0 auto;
                margin-top: -105px; 
            }

            * html #wrapper { 
                height:100%;
            }

            div.margin{
                width: 920px;  
                margin-right:auto;
                margin-left:auto;
                padding: 0px 30px 0px 30px;
            }

            div.header{
                height: 60px; 
                background-color:cornflowerblue;
            }

            div.footer{
                position: relative;
                clear:both;
                height: 105px; 
                background-color:#4E8084;
            }

           div.body_content{
                display: table; 
                background-color: red;
                height: 100%;
            }

            div.leftSide{
                width:25%;
                background-color: #F4F4F4;
                display: table-cell; 
            }

            div.rightSide{
                width: 70%;
                padding: 20px;
                background-color: #e8e7e7;
                display: table-cell; 
            }
        </style>
    </head>
    <body>
        <div id="wrapper">
            <div style="height: 105px;"></div>

            <div class="header margin">
                Welcome
            </div>
            <div class="body_content" style="clear: both;">
                <div class="leftSide">
                    <h2>Settings</h2>
                    <a href="#" id="personalButton" class="current">Personal</a>
                    <a href="#" id="securityButton">Security</a>
                </div>
                <div class="rightSide">
                    <h3>Title</h3>
                    <a class="m-btn blue-stripe">Save Changes</a>
                </div>
            </div>
        </div><!-- end #wrapper -->
        <div class="footer margin" >
            <span class="footer_links">
                something
            </span>  
        </div>
    </body>
</html>

Answer №1

Tackling this issue requires a bit of complexity. One way to solve it is by utilizing the CSS properties display : table, display : table-row, and display : table-cell. I suggest employing jQuery as shown below once the document has fully loaded.

function adjustSize() { 
       var height = $('#wrapper').outerHeight(true) - $('.header').outerHeight(true);
       $('.body_content').height(height);
}

JSFiddle

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

Conceal the Navigation Bar Upon the Pop Up's Appearance

I Designed a Landing Page with a Fixed Mobile Nav Bar at the Bottom. There is also a Pop-Up Form that appears when clicked. How can I make sure the Nav Bar is closed when the form pops up? This issue is blocking the Send Button. Is it possible to achiev ...

The structure of the figure tag for HTML5 validation

Could you please confirm if the Figure tag is correctly used in the html structure? Regarding html5 validation, can I use this structure? <a href="#"> <figure> <img src="" class="img-responsive" alt=""> <figcaption> ...

Leveraging JavaScript to format an HTML string

Is there a way to format an HTML string similar to how it's done in an HTML editor like Netbeans with Alt-Shift-F? I'm looking for a JavaScript function or library that can achieve this. Any suggestions? ...

What is the best way to retrieve values from a multi-select dropdown that functions effectively with each selection made

Currently, I am facing an issue in my program where I need to extract values from a multiple select option. The challenge lies in the fact that my view is in a .hbs file and the multiple select is populated using {each}. Here is a snippet of the code: Fir ...

Tips for adjusting a web address provided by a user

I have a JavaScript code that prompts the user to input a URL and then appends it to a div. The code is working fine, but now I am trying to add functionality to edit the entered URL by changing the width and height of any iframes before appending them. ...

Is there a way to restrict the number of checkboxes selected based on the values of radio buttons?

I am currently working with a group of radio buttons: <input type="radio" name="attending_days" value="06-18-13"/>Tuesday June 18, 2013 <input type="radio" name="attending_days" value="06-18-13"/>Wednesday June 19, 2013 <input type="radio" ...

The function of style.marginRight differs from that of style.marginLeft

One function aligns content to the left while the other doesn't align it to the right function openNavLeft() { document.getElementById("mySidenavLeft").style.width = "100vw"; document.getElementById("main").style.marginLeft = "100vw"; } function ...

Align a Bootstrap 4 container column both vertically and horizontally on top of a background image

After searching the internet for 5 hours, all I found was that each child of the column would line up horizontally. I included the nav bar as it sometimes interferes with the layout. <header> <nav class="navbar navbar-expand-lg navbar-dark bg ...

How can CSS be utilized to style the visited links that are hovered over

Is there a way to change the font color specifically for visited hyperlinks that are being hovered over by the mouse? I am trying to achieve this: a:visited:hover {color: red} ...

Utilize C# and SmtpClient to efficiently send HTML emails

Is there a way to send HTML emails instead of plain text using SmtpClient? I have been following the code provided in this solution, but the output always ends up as plain text. For example, the link in the sample message below is not displayed as an activ ...

Show the json data on a PHP table

I've been attempting to showcase JSON content in a PHP table, but I keep encountering errors. It seems like there are some syntax issues that I can't quite pinpoint. Any suggestions on what needs to be modified? PS. I'm using the Slim frame ...

What is causing this faint red line to persist within the parent container?

https://i.sstatic.net/U3dyK.png How can I get rid of the red line on the left side that is not disappearing, even though I've set the child div to white with a width of 50%? body{ height: 100vh; position: relative; } .main-container{ width: ...

Tips on aligning a form element with another element in a Bootstrap column

Is there a more efficient way to position a globe glyph directly to the right of a textbox in multiple places throughout my code, almost touching it? One possible solution is as follows: <div class="col-md-3"> <input class="form-control" ...

Import information from a MySQL table into a single input field

I am currently working on a project that involves retrieving data from a MySQL database and displaying it in a single field. Below is the MySQL code I am using: My goal is to load all the data from $row['db_numbers']; into the field. <input t ...

Discovering elements with Selenium through XPATH or CSS Selector

Having trouble locating the "import" element using Selenium Webdriver in C#. I've attempted the following codes but haven't had any luck: driver.FindElement(By.XPath("//*[@class='menu_bg']/ul/li[3]")).Click(); driver.FindElement(By.XPa ...

Detecting resolutions on an iOS Simulator using PhoneGap

As a newcomer to the world of development, I am diving into the process of creating iOS apps using Phonegap. To accommodate different resolutions, I have developed four separate CSS files. <link rel="stylesheet" media="only screen and (max-device-width ...

JavaScript progress bar disappears when displayed, but fails to indicate progress

When I click the button, I want a progress bar to appear and then update its progress. However, in my current code, the progress bar shows up but does not update. If I remove style="display: none", the progress bar updates as expected. Any sugge ...

How come I can click on both radio buttons simultaneously?

How come I can select both radio buttons simultaneously? <form #form="ngForm"> {{ poll.counter1 }} votes <input type="radio" id="{{ poll.choice1 }}" value="{{ poll.choice1 }}" (click)="onChoice1(form)">{{ poll.choice1 }} <br> ...

What steps can I take to use CSS to disable a webpage?

Is there a way to create a disabled web page using CSS where users cannot click on any content and only view the content below the screen? ...

Accessing a text document from a specific folder

As a novice in the world of HTML and PHP, I am attempting to develop a script that can access a directory, display all text files within it, allow for editing each file, and save any changes made (all operations will be managed through an HTML form). Howev ...