Responsive 4-Column CSS Footer Design

I am currently working on developing a simple 4 column CSS footer that adapts to various screen resolutions such as desktop, tablet, and mobile devices.

The footer should have a maximum width of 980 pixels, with the blue background expanding to fill the window if it exceeds this width. When the window size decreases below 980px, the columns should stack on top of one another according to my diagram.

Unfortunately, I am facing issues with the blue background not displaying correctly and the columns failing to stack up when the window is resized smaller; instead, their width decreases.

Fiddle: http://jsfiddle.net/Gar3H/

HTML

<div id="wrapper">
<div id="footer">
<div class="footerFloat">
<h4>Header 1</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="footerFloat">
<h4>Header 2</h4>
<ul>
  <li>Line 1</li>
  <li>Line 2</li>
  <li>Line 3</li>
  <li>Line 4</li>
</ul>
</div>
<div class="footerFloat">
<h4>Header 3</h4>
<ul>
  <li>Line 1</li>
  <li>Line 2</li>
  <li>Line 3</li>
  <li>Line 4</li>
</ul>
</div>
<div class="footerFloat">
<h4>Header 4</h4>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>

CSS

#wrapper {
    width: 100%;    
    max-width: 980px;
    margin: auto;
} 


#footer {
    background-color: blue;
    width: 100%;
} 

.footerFloat {
    width: 25%;
    float: left;
}

Answer №1

Presented below is a functional version

http://jsfiddle.net/Gar3H/3/

CSS:

#footer {
    width: 100%;
    margin: auto;
}
.footerFloat {
    width: 100%;
}
@media all and (min-width: 950px) {
    #footer {
        width: 980px;
        margin: auto;
    } 
    .footerFloat {
        width: 25%;
        float: left;
    }
}

#wrapper {
    background-color: blue;
    width: 100%;
    overflow:hidden;
} 

This code snippet utilizes media queries to demonstrate how browsers prioritize CSS rules

Answer №2

Just like this

see the demo here

style sheet

#container {
    width: 100%;    
    max-width: 980px;
    margin: auto;
} 


#footer {
    background-color: blue;
    width: 100%;
    float:left;
} 

.footerContent {
    width: 25%;
    float: left;
    min-width:200px;

}

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

Applying flexbox to create a visually appealing design

Is there a way to achieve this layout using flexbox without relying on grid due to limited support in IE11? I want to be able to easily add or remove small divs without adding more containers. To see the desired layout, check out this image: Desired Layou ...

What is the best way to remove the class "active" from only one of the <li> elements using jQuery?

I am currently facing a challenge in figuring out how to remove the "active" class from just one of my lists. Here is an example of my navigation bar: <div class="container"> <ul class="nav"> <li class="active"><a href="#">& ...

jQuery Mobile for Enhanced Customer Relationship Management on the Web

I have recently been tasked with creating a Web Based CRM Software and I plan to use PHP and MYSQL as my backend. For the frontend, I am considering using a UI framework such as jQuery Mobile. I like that it is fully AJAX-driven, easy to code with, and has ...

The bootstrap carousel images are arranged in a vertical stack, regardless of the size of the screen

I'm having some trouble with my bootstrap carousel. The images are stacking on top of each other when the page loads, even though everything else seems to be working fine - controls, indicators, etc. Any ideas on what's causing this issue? <! ...

"Uploading" a picture using jQuery

I have been using this particular code snippet to display messages. setTimeout(function(){ o.html(o.html() + "Username:<br>" + msg[r] + "<br><hr>") }, 7000); It's effective in posting messages from an array and adding some st ...

Each function in Sass is compiled with a dollar sign preceding it

I'm having trouble using an each loop in Sass because the css is compiling with the variable names instead of their content. $green-1: #9ae200; $green-2: #5ea600; $color-list: green-1 green-2; @each $single-color in $color-list { &.#{$single ...

Unable to navigate to the top of the page in React

When I have a React component with a scrollable div, I am attempting to make the div scroll to the bottom after it is mounted: componentDidUpdate() { var scrollNode = ReactDOM.findDOMNode(this.scrollElement); scrollNode.scrollTop = scrollNode.scro ...

Show an error notification if the mobile device does not meet the requirements for jquery mobile version

Currently, I am in the process of creating a website using HTML5, CSS3, and jquerymobile. My goal is to have an error message appear saying "Your mobile browser does not support this application" if the page is not rendering correctly or if the jquery mobi ...

What is the best way to share dynamic content from a DIV or SPAN element on WhatsApp using jQuery?

I’ve been attempting to share the text content of a specific DIV on WhatsApp, but so far I haven't been successful. My goal is to only share a portion of the document (specifically the contents of showques). Below is the code snippet I've been ...

What is the best way to conceal an HTML element on a particular page that is already styled as (visibility: visible), but only if its child has a specific class assigned to it?

I have a grid of content and posts displayed on multiple webpages. Users can select specific items from the grid to navigate to more detailed information on another page. Each webpage has its own grid which I want to filter based on a specific class. The ...

What is the best way to make hyperlinks in impress.js?

Wanting to craft a visually stunning brochure for my client with the help of impress.js. I want to include a link on each slide that directs to the relevant page when clicked. Is it feasible to have a clickable link to each slide on every page as well? ...

How can I make my iPad switch to landscape mode in my specific situation?

I'm attempting to trigger the landscape mode on an iPad web browser, including the address bar and tabs, when a user clicks a link. Here's what I currently have: <div> <a ng-click="click me()" href="www.cnn.com">Click me</a&g ...

Tips for sorting the array in angularJS according to the length of its subarray

Here is a model I am working with: public class City { public string Name {get; set;} public List<Classified> Classifieds {get; set;} public List<Area> Areas {get; set;} } Within my AngularJS controller, my code looks ...

Generating duplicate elements conditionally in Typescript

One of the functionalities in my application involves a variable that users can adjust, for example: let myValue = 3; What I want to accomplish is to generate multiple duplicates of an element in my HTML based on the value of this variable. For instance ...

Utilizing inter-process communication in Electron to establish a global variable from the renderer process

renderer.js ipcRenderer.sendSync('setGlobal', 'globalVarName').varInner.varInner2 = 'result'; main.js global.globalVarName = { varInner: { varInner2: '' }, iWontChange: ' ...

The background property does not support linear-gradient in CSS

I am currently working on creating a tree structure using the vue-orgchart library (link) Everything is functioning correctly, but I am interested in changing the green background color of the node (ignoring the white portion). https://i.sstatic.net/EEcd ...

Can you please tell me the font size specified as 20px/26px?

Recently stumbled upon the 20px/26px value in a codebase I'm currently working on. Wondering if anyone has encountered this before and knows what its purpose is. Interestingly, it renders with the latter pixel value (26px) in Chrome. #action { font: ...

Transferring an email containing an HTML file along with embedded images

Is there a way to send HTML emails with images using C#? Can I simply insert a direct link to an image hosted on my server (similar to <img src="http://mysite.ru/img.png" />) or do I need to attach the image and then use a link to the attached file ...

Access local files by utilizing iframe

I attempted to load files via an iframe, however, it was unsuccessful. I am attempting to load a file from: C:/Users/Tom/Desktop/Courses/c2.pdf and I tried: <iframe src="file:///C:/Users/Tom/Desktop/Courses/c2.pdf></iframe> Unfortunately, no ...

Is there a way to modify the style value within AngularJS?

<div class="meter"> <span style="width: 13%"></span> </div> I have the following HTML code snippet. I am looking to update the width value using AngularJS. Does anyone have a solution for this issue? ...