information occupies the entirety of the area between the top and bottom of the page

My minimalist design includes a header, main section, and footer. The footer is positioned at the bottom of the page while I want the main section to fill the space between the header and footer.

Take a look at my approach here: http://jsfiddle.net/5d3m9/

HTML

<div class="wrap">
   <header>header</header>
   <div class="main">lorem2000 </div>
   <div class="clear"></div>
   <footer>@Copyright</footer>
</div>  

CSS

html, body {
    height: 100%;
}

body {
    margin: 0;
}

header {
    height: 150px;
    background: orange;
}
.wrap {
    min-height: 100%;
    position: relative;
    overflow: hidden;
}
.main {
    background: #00eaea;
    padding-bottom: 32767px;
    margin-bottom: -32767px;
}
.clear {
    height: 50px;
}
footer {
    background: #dadada;
    height: 50px;
    width: 100%;
    position: absolute;
    bottom: 0;
}

Are there alternative or more effective methods to achieve this layout without using

padding-bottom: 32767px; margin-bottom: -32767px;
?

Answer №1

Implement the style below to .primary

.primary {
    background-color: #00eaea;
    top: 150px;
    bottom: 50px;
    position: absolute;
    width: 100%;
}

http://jsfiddle.net/9y7d1h/

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

What is the best way to ensure the feature image is perfectly centered vertically for every post on Wordpress?

I currently have a vanilla website with numerous posts, each of which has a banner feature image set to "top aligned" as the default setting. This results in an unappealing layout. I am looking for a way to vertically center align all banner featured image ...

Issue duplicating DIV elements using jQuery's clone() method causes button duplication error

Just starting out with programming, so my code might not be perfect. I'm encountering an issue when I click a button in the HTML (Fiddle) $(document).ready(function() { $("button").click(function() { $(".groupcontainer").clone().appendTo(".grou ...

I am having trouble getting my JavaScript to load

I've hit a roadblock trying to understand why my JavaScript code isn't executing properly. Could someone kindly point out what I may have overlooked? :( JSFiddle Link HTML Snippet <div class="po-markup"> <br> <a href="# ...

Engage in a conversation with a specific individual on the internet using node.js

Looking to implement a chat feature with specific online users similar to Facebook or Gmail using node.js and socket.io. Can anyone assist me with this? Thanks in advance! Client.html <html> <head> <title>My Chat App</title> <d ...

Should I be decoding strings from the server like this in my JavaScript code?

When retrieving JSON data from an ASP.NET web service that has been HtmlEncoded using Microsoft's AntiXSS library (Encoder.HtmlEncode()), and returned as JSON through a jQuery Ajax call, I am faced with the task of setting this data on form inputs. O ...

Adjusting the width of columns in a table

Previously in Bootstrap 3, I was able to use col-sm-xx on the th tags within the thead to resize table columns as needed. However, this functionality is no longer available in Bootstrap 4. How can I achieve a similar effect in Bootstrap 4? <thead> & ...

Is there a way for rainyday.js to utilize a CSS background image as its background?

I have a simple website with a fixed, full-sized background set using CSS. I am trying to incorporate rainyday.js to create a rain effect over the entire site, including the text. Currently, I am only able to get rainyday.js to display rain over a small s ...

Can file input be saved using only JQuery?

I'm currently developing a Chrome Extension which requires the user to upload an audio file on the options.html page. Due to restrictions, I am unable to utilize PHP in writing this extension. Hence, I am seeking advice on how to save the uploaded aud ...

How can I customize the appearance of the container and items in a dropdown <select> menu?

Im using contact form 7 on wordpress, i don't want to use a plugin rather use plain css/js to bring the results if possible. Something like this : https://i.stack.imgur.com/VTWRg.jpg ...

How can I use Python Selenium to replicate the styles of elements in Chrome?

Looking at this image, we can manually extract styles using copy > copy styles from Chrome. But is there a way to achieve this using Selenium? https://i.sstatic.net/3XzsT.png Although this guide explains how to obtain the CSS value of a specific eleme ...

Guide on adding an image to a Bootstrap card component

I'm facing a simple issue that I can't seem to solve. As a beginner in using bootstrap, I'm struggling to figure out how to insert an image into the card header. I've been searching online for solutions for the past 30 minutes with no l ...

Tips for designing resizable overlay divs

Looking to design an image with an overlay gradient and text, similar to this: <div> <img src="url"/> <div background-image="other url" background-repeat:repeat-x;> <h2>some text</h2> </div> </div> Some impor ...

Toggling submenu visibility with click event in jQuery and HTML

As a newcomer to jQuery, I have successfully created a vertical menu. My objective is as follows: When the first list item is clicked, it should display the submenu. Clicking on the second list item will show the level 1 submenu while closing the first on ...

Incorporate a background image into input fields with Autofill on mobile browsers to override the default yellow background that obscures them

It is common knowledge that modern browsers apply a less than appealing yellow background to text fields when Autofill is used by visitors. A helpful workaround is known to override the default text and background colors, and even incorporate a background ...

Using javascript to save the contents of a textbox as cookies, then displaying the result

I am a beginner in the world of JavaScript and I am looking for an easy solution. Can someone please guide me on how to store the values entered in two text boxes on one HTML page, and then display them on another HTML page? ...

What is the best way to allocate a unique color to every item within an array?

I've been working on some JavaScript code that pulls a random color from a selection: const colors = [blue[800], green[500], orange[500], purple[800], red[800]]; const color = colors[Math.floor(Math.random() * colors.length)]; Within my JSX code, I ...

What are the steps to modify data within the root component?

I am currently working on a Vue project with vue-cli and routes. In my App.vue file, the template structure is as follows: <template> <div id="app"> {{Main}} <router-view></router-view> </div> </template&g ...

Ways to align modal popup next to a button

Hello! I've implemented a dialog modal popup using jQuery, which can be viewed at this link: http://jqueryui.com/dialog/#modal-message. By default, the dialog box appears in the center of the frame. However, I would like to position the modal box next ...

Authenticating with Google using a Custom Application Title

My website currently requires Google+ authentication in the following way - However, I want to revamp it to resemble stack overflow's method - Here are two necessary changes - 1) Replace This app with My App Name 2) Include only View your email ad ...

Let's apply some CSS to the font style within the body

I've been incorporating a "footer.php" page into all other pages of my website. This footer showcases the site's name at the bottom of the screen and uses a custom font loaded with @font-face. Initially, I had something like this placed inside t ...