Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make a centered div container that can stretch vertically based on the elements inside?
    primarykey
    data
    text
    <p>I'm brand new to this and I'm trying build a simple layout of divs. I'd like to have 3 container divs: header, content, footer. The content div I don't want to have the height fixed, I want it to stretch based on whatever is inside of it. Also I don't know javascript so I want to do it with HTML/CSS only. </p> <p>I've looked on this site for answers, but they don't seem to work. Here is the HTML:</p> <pre><code>&lt;body&gt; &lt;div id="header" style="background:beige;"&gt; &lt;div id="logo" style="background:gray;"&gt; put logo here &lt;/div&gt; &lt;div id="navigation" style="background:grey"&gt; About Us, Contact Us, Etc.... &lt;/div&gt; &lt;div id="content" style="background:beige;"&gt; &lt;div id="bigbox" style="background:black; color:white;"&gt; big box would have some slide show here &lt;/div&gt; &lt;div class="smallbox" id="smallboxleft" style="background:green;"&gt; smallboxleft &lt;/div&gt; &lt;div class="smallbox" id="smallboxmiddle" style="background:green;"&gt; smallboxmiddle &lt;/div&gt; &lt;div class="smallbox" id="smallboxright" style="background:green;"&gt; smallboxright &lt;/div&gt; &lt;/div&gt; &lt;div id="footer" style="background:navy; color:white;"&gt; This is the footer &lt;/div&gt; </code></pre> <p>Here is the CSS:</p> <pre><code> #header{margin:0 auto; height:100px; width:960px; position:relative; } #logo{height:100px; width:200px;} #navigation{height:50px; width:400px; position:absolute; left:560px; top:50px;} #content{margin:0 auto; width:960px; height:100%; position:relative; top:25px;} #bigbox{position:absolute; height:300px; width:860px; position:absolute; left:50px; top:125px;} .smallbox{position:absolute; height:150px; width:300px; top:450px;} #smallboxmiddle{left:320px;} #smallboxright{left:640px; } #footer{position:absolute; height:100px; width:960px; top:625px;} </code></pre>
    singulars
    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