Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Maybe there is solution with CSS only, but here is jQuery solution. Content below menu will fill rest of space, without scroll bars.</p> <p><strong>HTML</strong> markup will be:</p> <pre><code>&lt;div id="menu"&gt;SOMETHING IN MENU&lt;/div&gt; &lt;div class="content"&gt; &lt;div class="part1"&gt;&lt;/div&gt; &lt;div class="part2"&gt;&lt;/div&gt; &lt;div class="part3"&gt;&lt;/div&gt; &lt;div class="part4"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>CSS</strong>:</p> <pre><code>body,html{padding:0; margin:0;height:100%;width:100%;} #menu { position: fixed; top: 0; background: blue; height: 50px; width: 100%; } .part1 { width:50%; height: 50%; float: left; background: purple; } .part2 { width:50%; height: 50%; float: left; background: red; } .part3 { width:50%; height: 50%; float: left; background: green; } .part4 { width:50%; height: 50%; float: left; background: silver; } .content{ width: 100%; position: relative; } </code></pre> <p><strong>jQuery</strong>:</p> <pre><code>var height = $(document).height(); var menu_height = $("#menu").height(); var content_height = height - menu_height; $(".content").css("height", content_height); $(".content").css("top", menu_height); </code></pre> <p><a href="http://jsfiddle.net/QEdxW/1/" rel="nofollow"><strong>DEMO</strong></a></p> <p>Most important part is jQuery. First, we need to get height of document (html), then height of menu. Then, we substract menu height from document height, and result is content height. Same result we will apply to top position of content, to avoid overlaping.</p>
 

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