Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic content that changes height depending on header and footer height
    primarykey
    data
    text
    <p>I'm trying to make a page that contains 3 elements: Header, footer and content. As the names suggest, I want the header stuck to the top, the footer in the bottom, and the content in between. I have already made a layout, which puts the header and footer where they are supposed to be, but the content either overlaps them, or the other way around, where the content is supposed to get smaller instead.</p> <p>My problem is that the header and footer are going to be used for many different things, and they are therefore dynamic when it comes to height. </p> <p>Is there any way to make the content fill what space is left between the header and footer, without overlapping any of them?</p> <p>If possible I would prefer pure CSS, but if that isn't possible, I'd like a JavaScript suggestion as well. :)</p> <p>Thanks!</p> <p>EDIT: This is what I got atm.</p> <pre><code>&lt;div class="container"&gt; &lt;div id="header"&gt;&lt;/div&gt; &lt;div id="footer"&gt;&lt;/div&gt; &lt;div id="content"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>#content { position:absolute; background: url('img/textures/fabric.png'); background-color: gray; height:auto; width:auto; margin:0 auto 0 48px; /* Center content */ left:0; right:0; top:0; bottom:0; text-align:center; } #dashtop { position:fixed; width:auto; background-color:aqua; opacity: .5; margin-left: 48px; top:0; left:0; right:0; text-align:center; } #footer { position: fixed; margin-left: 48px; background-color:green; bottom:0; right:0; left:0; width:auto; height:auto; text-align:center; opacity:0.5; z-index:0; </code></pre> <p>} </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload