Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML background/layout
    primarykey
    data
    text
    <p>I'm just getting into HTML and CSS and I have a quick question. Is there any way to make a parent element grow in size to accommodate one of its children? I have the background set on <code>&lt;html&gt;</code>. Then inside the body I have a div which sets a different background color and isn't as wide/tall as the whole page. This leaves a two toned design. Then, I have a nested div containing all the content to be displayed. This all works fine, unless the page content is enough that a scroll bar is necessary. If that happens, both background colors are lost past the original bottom of the screen. This problem is extremely annoying and from what I've read there is no great way to handle it, but I wanted to see if anyone knew. I have the following properties set:</p> <pre class="lang-css prettyprint-override"><code>html { background: [gradient code...] height: auto; min-height: 100%; background-repeat: no-repeat; background-size: 100%; } body { height: auto; width: 100%; position: absolute; bottom: 0; top: 0; margin: 0; padding: 0; border: 0; } div.background { background-color: #D0D0D0; text-align: center; height: auto; width: 70%; position: absolute; top: 150px; bottom: 30px; left: 15%; margin: 0; padding: 0; border-radius: 7px; } div.container { height: auto; width: 70%; position: absolute; left: 15%; bottom: 0; top: 0; } </code></pre> <p>Where <code>div.background</code> has the second background color and <code>div.container</code> has the content displayed on the page.</p> <p>Thanks for your help.</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.
 

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