Note that there are some explanatory texts on larger screens.

plurals
  1. POInner div to scroll if outer div is too small?
    primarykey
    data
    text
    <p>I'm trying to make a sidebar which on a website which will have a "panel" in it containing contact info. The problem is that on smaller screens, the text overflows the background. </p> <p>Here is the CSS, where #navigation is the outer div and the inner div is called .innerPanel HTML to follow:</p> <pre><code> #navigation{ position: absolute; left: 1.5625em; top: 1.5625em; bottom: 1.5625em; display: block; width: 12.5em; background: navy; border-right: 1px solid navy; text-align: center; background: #B6D2F0; padding: 5px; color: #4A4A49; overflow: hidden; } #navigation .innerPanel{ min-height: 200px; /* supply current height here */ height: auto; overflow: auto; } .titleHead{ display: block; padding-top: 0.9em; overflow: auto; } /* inverted corners for the links */ #navigation #links { position: relative; padding-top: 30px; } #navigation #links div div div h3{ border-top: 1px solid navy; border-bottom: 1px solid navy; color: navy; padding: 0px; margin: 0px; margin-top: 1px; line-height: 1.2em; } #navigation div div div div ul{ list-style-type: none; margin: 0px; padding: 0px; } #navigation div div div div ul li{ text-align: center; } #navigation div div div div ul li a{ display: block; text-decoration: none; font-weight: bold; color: #B6D2F0; padding: 0px; padding-left: 0; line-height: 2.5em; background: navy; border-bottom: #D8F4F2 1px dashed; } #navigation div div div div ul li a:hover{ display: block; text-decoration: none; font-weight: bold; color: #D8F4F2; background: #0000A2; } #navigation div div div div ul #last a{ border-bottom: 0px; } </code></pre> <p>`</p> <p>Here is the HTML fragment. The nested <code>div</code> tags were for rounded corners, which were "nixed" by the client</p> <pre><code> &lt;div id="navigation"&gt; &lt;div id="logo" class="box"&gt; &lt;div&gt; &lt;div&gt; &lt;div style="text-align: center;"&gt; &lt;img src="./images/pictures/cbk-logo-sm.gif" alt="Logo" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="links" class="box"&gt; &lt;div&gt; &lt;div&gt; &lt;div&gt; &lt;ul&gt; &lt;li id="home"&gt; &lt;a href="index.php" title="Home"&gt;Home&lt;/a&gt; &lt;/li&gt;&lt;li&gt; &lt;a href="applications.php" title="Apply as a staff member or camper"&gt;Applications&lt;/a&gt; &lt;/li&gt;&lt;li id="last"&gt; &lt;a href="about.php" title="About our directors, our grounds and our campers"&gt;About&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;div class="innerPanel"&gt;&lt;div class="innerMost"&gt;&lt;h4 class="titleHead"&gt; Contact Information&lt;/h4&gt; &lt;h5 style="margin: 0.8em 0 0 0; padding: 0;"&gt;City Office (September-June)&lt;/h5&gt; &lt;p style="font-size: 0.75em; margin: 0; padding: 0;"&gt; &lt;em&gt;Phone:&lt;/em&gt; 555-555-5555&lt;br /&gt; &lt;em&gt;Fax:&lt;/em&gt; 555-555-5555&lt;br /&gt; &lt;em&gt;Email:&lt;/em&gt; email@provider.com&lt;br /&gt; &lt;em&gt;Address:&lt;/em&gt; 123 Main Avenue Somewhere, IL 11234 &lt;/p&gt; &lt;h5 style="margin: 0.8em 0 0 0; padding: 0;"&gt;Camp (July &amp;amp; August)&lt;/h5&gt; &lt;p style="font-size: 0.75em; margin: 0; padding: 0;"&gt; &lt;em&gt;Phone:&lt;/em&gt; 987-654-3210&lt;br /&gt; &lt;em&gt;Fax:&lt;/em&gt; 123-456-1234&lt;br /&gt; &lt;em&gt;Email:&lt;/em&gt; email@provider.com&lt;br /&gt; &lt;em&gt;Address:&lt;/em&gt; 456 Centre Road, Nowhere, AL 67891 &lt;/p&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I need a cross-browser solution to make <code>innerPanel</code> dynamically add a scrollbar to itself so that on smaller screens, the content is clipped but accessible via scroll...</p> <p>Preferably, the solution should be pure CSS.</p> <p>Any ideas?</p> <p>EDIT: I apologize for the ambiguity. I have a sidebar, called <code>#navigation</code>. It contains a logo, the menu and the contact information. I want the contact info to scroll where needed.<br> Everything else seems to display normally on 800x600 screens and up.</p> <p>EDIT: As it stands now, innerPanel is a fixed height. I would like it to grow when possible, and if there is enough room, eliminate the scrollbar. Please note that there is an HTML div not mentioned in the CSS, which is contained inside of <code>innerPanel</code>.</p>
    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.
    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