Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The variable height of the footer causes a slight problem but the following should work:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; html { height: 100%; } body { min-height: 100%; } .container { min-height: 100%; position: relative; } .content { padding-bottom: 200px; } .footer { position: absolute; bottom: 0px; background: #ebebeb; text-align: centre; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;div class="content"&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;p&gt;Content&lt;/p&gt; &lt;/div&gt; &lt;div class="footer"&gt; &lt;p&gt;This is my footer.&lt;/p&gt; &lt;p&gt;This is another line of my footer.&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The padding on the bottom of .content means the footer won't ever overlap the content. However, given your footer will be variable sizes I'd use javascript to dynamically set the padding on the bottom of the content once on page load or each time you change the height of the footer:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $(".content").css("padding-bottom", parseInt($(".footer").height() + 20) + 'px'); }); &lt;/script&gt; </code></pre> <p>I know you said pure CSS but I don't think there's a way given the variable height and hiding-sticky conditions. I think this is the least javascript method. </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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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