3-column responsive footer design using CSS

My CSS code includes media queries to make my footer responsive for smaller screens:

#footer-top {
    width:100%;
    height:480px;
    padding-top:10px;
    border-bottom:2px #000000 solid;
}
#footer-left {
    width: 290px;
    float: left;
    padding: 5px 15px;
    border-right:1px #000000 solid;
}
#footer-middle {
    width: 294px; /* Account for margins + border values */
    float: left;
    padding: 5px 15px;
    margin: 0px 5px 5px 5px;
    border-right:1px #000000 solid;
}
#footer-right {
    width: 270px;
    padding: 5px 15px;
    float: left;
}
#footer-bottom {
    clear: both;
    padding: 0 15px;
}

/* Adjustments for screen sizes below the specified limits */
@media screen and (max-width: 980px) {
    #footer-left {
        width: 41%;
        padding: 1% 4%;
    }
    #footer-middle {
        width: 41%;
        padding: 1% 4%;
        margin: 0px 0px 5px 5px;
        float: right;
    }
    #footer-right {
        clear: both;
        padding: 1% 4%;
        width: auto;
        float: none;
    }
    #footer-bottom {
        padding: 1% 4%;
    }
}

@media screen and (max-width: 600px) {
    #footer-left {
        width: auto;
        float: none;
    }
    #footer-middle {
        width: auto;
        float: none;
        margin-left: 0px;
    }
    #footer-right {
        width: auto;
        float: none;
    }
}

@media screen and (max-width: 480px) {
    #footer-right {
        display: none;
    }
}

I have also provided a fiddle here:http://jsfiddle.net/VMn7Y/ with the full HTML for better context. However, when shrinking the screen size, the footer-right div overlaps the footer-bottom div. How can I ensure that as the screen size decreases, the footer-bottom div is pushed down accordingly?

Answer №1

In order to fully answer the question, I recommend removing the height:480px attribute from the #footer-top element as shown in this example --- > http://jsfiddle.net/VMn7Y/17/

I trust this is the solution you were looking for!

Answer №2

One trick to using media queries effectively is to start with smaller screen sizes and then work your way up for better results.

Your fiddle has been corrected by simply adjusting the width to 30% (or 27% when factoring in padding).

Take a look at the updated code snippet below:

float:left;
padding: 5px 10px;
width:27%;

Check out the fixed jsfiddle here

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

Ways to change the background color of a specific row and an entire table with JavaScript

In my application, I have implemented a feature where clicking on the "Add New Item" button adds rows dynamically using Javascript. Each input field in the dynamically added rows has a unique ID, and this functionality is working smoothly. When a number f ...

Resolve the issue pertaining to the x-axis in D3 JS and enhance the y-axis and x-axis by implementing dashed lines

Can anyone assist with implementing the following features in D3 JS? I need to fix the x-axis position so that it doesn't scroll. The values on the x-axis are currently displayed as numbers (-2.5, -2.0, etc.), but I want them to be shown as percentag ...

What are some effective strategies for keeping content from shrinking in a drawer menu?

I am currently using a tutorial from https://www.w3schools.com/howto/howto_js_sidenav.asp to create a drawer sidebar menu. However, in my scenario, I need to include a wall of text instead of <a> links. The issue I am facing is that the text expands ...

Recreate body content with JQuery Mobile

I've been attempting to duplicate the entire HTML content within the tags. However, even though the appearance on screen is correct, none of the links are functioning.</p> <p>To view the fiddle, click here: [Here is a fiddle][1]</p> ...

Need some assistance in finding a way to input multiple values from multiple buttons into a single input field in JavaScript

Hello, I am looking for a little help with reading multiple values using multiple buttons such as 1, 2, and 3, and displaying the output in the input like '123' instead of just one number at a time. Concatenate numbers with every click. <inpu ...

Mobile Mode Blocking Bootstrap Navigation

Why is my bootstrap navigation stuck in mobile mode even on desktop devices? What mistake have I made? <div id="main-menu-container" class="collapse navbar-collapse"> <ul id="menu-main" class="navbar-nav mr-auto"> ...

PDF files encoded in base64 are not displaying properly in Chrome

There seems to be an issue with certain PDF files not rendering properly in Chrome browser but working fine in Firefox. Interestingly, all files render correctly when embedded directly. <object id="content-view" :data="content_view.base64" type="applic ...

Maintain the vertical alignment of an item at a fixed point, even as the height of the

I'm currently working on a multi-step form project with three tabs, each containing a different section of the form and varying heights. The challenge I'm facing is to center the tallest tab vertically on the page, while aligning the other two ta ...

jQuery body background changer/utilizer

I am currently developing a website that requires the functionality to switch between background images with the ability for users to navigate through them using back and forth arrows. Each background image should have a unique dynamic description associa ...

Displaying local time alongside global time using PHP

I have a challenge - I am storing time in DATETIME format and now I need to display it in the local timezone. Does anyone know how to achieve this using PHP? ...

I am experiencing issues with the HTML footer not displaying correctly on my website

My GitHub Pages hosted website is giving me trouble with the footer styling. No matter what I try, I can't seem to get the background color to show up: h1 { background-color: #000000; } I'm attempting to create a footer similar to the one at ...

What is the best way to find the initial row of an HTML table with Angular?

When working with the code snippet in my doSomething method shown below, I am curious about how to accurately identify the rowIndex. <tr ng-repeat="a in mydata"> <td><b>{{doSomething(mydata.name)}}</b></td& ...

How to toggle the visibility of a div with multiple checkboxes using the iCheck plugin for jQuery

I customized my checkboxes using the icheck plugin to work with both single and multiple checkboxes, including a "Check all" option. Here is an example of how it looks in HTML: HTML : <div>Using Check all function</div> <div id="action" c ...

Incorporating personalized CSS styles into a Bootstrap 4 card

I have been scouring through countless questions and solutions on StackOverflow, but nothing seems to be working for me. While p-5 is doing its job just fine for padding, it applies to all devices. I am in need of specific CSS for mobile devices when it co ...

Is the default animation duration of Compass being ignored?

After recently updating to Compass version 1.0.16, I started setting up basic usage of the new animation features. However, I encountered an issue where setting default values for different animation settings did not take effect. This led me to hard-code t ...

What's the best method for styling a textarea in HTML without affecting the positioning of other elements?

I'm relatively new to HTML and I'm working on a platform using Apps Script. This platform is designed to analyze specific attributes of users, which are accessed through a window containing all the relevant information about that user. The data i ...

What is the method for configuring input in a session without having to submit it?

I am encountering a major issue with my PHP MVC pattern website. On one page, I did not implement a "POST" submit method and now I am facing difficulties in passing quantity to the products/order page. If I use a Submit button, the next page does not funct ...

Using the drop and drag features within a table cell

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.8.2.js"></script> <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> & ...

Adjusting the inner div dimensions to be 100% of the body's size without relying on the parent div using JavaScript

I have a main layer with multiple layers stacked on top of it. I need the second layer to extend its width to match the body's width. Main Project: http://example.com What I've tried: I looked into: Solution for matching div width with body ...

Enhancing the appearance of my website's shared content on Facebook: A guide

When I share links from well-known news sites like TNW and Engadget, the preview looks great with a thumbnail, bold title, and summary. But when I try to share one of my website's articles, it doesn't look as appealing. Is there a way to customiz ...