Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML&CSS + Twitter Bootstrap: full page layout or height 100% - Npx
    primarykey
    data
    text
    <p>I'm trying to make following layout:</p> <p></p> <pre><code> +-------------------------------------------------+ | Header + search (Twitter navbar) | +------------+------------------------------------+ | | | | | | |Navigation | Content column | | | | | | | | | | | | | | | | | | | +------------+------------------------------------+ | Footer | +-------------------------------------------------+ </code></pre> <p></p> <p>Layout must take all available height &amp; width, navigation and content columns take all available space and scroll on overflow, footer should stick to bottom.</p> <p>HTML looks like this now:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Bootstrap 101 Template&lt;/title&gt; &lt;!-- Bootstrap --&gt; &lt;link href="css/bootstrap.min.css" rel="stylesheet" media="screen"&gt; &lt;link href="css/bootstrap-responsive.min.css" rel="stylesheet" media="screen"&gt; &lt;link href="css/app.css" rel="stylesheet" media="screen"&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt; &lt;script src="js/app.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container-fluid"&gt; &lt;div class="navbar"&gt; &lt;!-- navbar content --&gt; &lt;/div&gt; &lt;div class="row-fluid columns"&gt; &lt;div class="span2 article-tree"&gt; &lt;!-- navigation column --&gt; &lt;/div&gt; &lt;div class="span10 content-area"&gt; &lt;!-- content column --&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="footer"&gt; &lt;!-- footer content --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>CSS:</p> <pre><code> body, html, .container-fluid { /// take all available height height: 100%; } .article-tree { color: #DCE6E5; background: #2F323B; } .content-area { overflow: auto; height: 100%; /// explicit height to make scrolling work } .columns { height: 100%; /// columns should take all height margin-top: 42px; /// minus header margin-bottom: 20px; // minus footer } .columns > div { height: 100%; // make each column to take all available height } .footer { background: red; height: 20px; } </code></pre> <p>In theory it should work, but columns.margin doesn't work as I expect. I thought it should make height = 100% - magin, but it just moves the container.</p> <p>I've googled and seen numerous questions on StackOverflow. All of them include JavaScript or position: absolute and manual positioning. IMHO they're more hacks than a solutions, I think there should be some simpler and more elegant and cross-browser way to solve this problem.</p> <p>So how do I make layout described above? Maybe Bootstrap can help me (I've looked through documentation, but there are no mentions of cases like this)?</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.
 

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