views:

111

answers:

4

So here's a stump I've hit.

I'm designing a... Thing. It sizes itself to the browser window, with some controls at the top and a rather large list near the bottom. Anyways, it's basically a table cell that sizes with the browser window, whos size is the document size - 130px in height, and document size - 50px in width. What I want it to do, is when the list of stuff inside that cell is bigger then the cell, it to become scrolly using css's overflow: auto.

The problem, is that I can't get it to do that, only make the entire document scrolly. Currently, the cell has no properties aside from valign:top, and it has a single div in it (to which the list elements are written), and it's set to overflow:auto. However, it's just scales up the entire document when the list becomes to long.

I don't want to give it a static size since it sizes with the page.

Any ideas?

Thanks! -Dave

A: 

I think an iFrame would help. Put your 'thing' into a base URL, and then use another page with an iFrame to load it. As the 'thing' goes crazy in size, the scroll bars appear, but your outer page is not effected.

An old fashion frame should work too, but iFrames are just more fun ....

Paul W Homer
Hi, thanks for the reply. An iframe would indeed work, but yeah as you said, they are old fashioned, and would me to restructure the design.
plain-old Frames are old fashion, iframes are new and exciting :-)
Paul W Homer
The iframe is not new and not exciting.
Joe Philllips
Ok, not so new (unless you compare them to frames) but still exciting :-)
Paul W Homer
+1  A: 

I'm not sure I understand correctly, but here's a try that may give you ideas.

<head>
<title>Test</title>
<style>
div.outer {
    background-color: red;
    position: absolute;
    top: 40px; 
    bottom: 40px;
    left: 40px;
    right: 40px;
}
div.inner {
    position: absolute;
    top: 0; 
    bottom: 0;
    left: 0;
    right: 0;
    overflow: auto;
    background-color: aqua;
}
</style>
</head>

<body>

<div class="outer">
<div class="inner">
On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create pictures, charts, or diagrams, they also coordinate with your current document look.
You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can also format text directly by using the other controls on the Home tab. Most controls offer a choice of using the look from the current theme or using a format that you specify directly.
To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery provide reset commands so that you can always restore the look of your document to the original contained in your current template.
</div>
</div>

</body>
buti-oxa
Ah, excellent idea! That solved it.Many thanks!
Very nice example, but it doesn't work in IE.
alexmeia
@alexmeia I works in IE for me. I run IE8, though. Do you have earlier version?
buti-oxa
A: 

The solution of buti-oxa is very nice, but doesn't work in Internet Explorer. For a cross-browser solution, you need to assign a fixed height to the div that contains the list. You can't do it using only css, because the height to assign depends from the height of the browser window. But you can use a simple javascript function to dinamically assign the height to the div. Here is an example, using jQuery:

function resizeDiv(){
    var h = $(window).height(); //maybe the window height minus the header and footer height...
    $("#yourDivId").css("height", h + "px");
}

You should call this function when the page is loaded and when the user resizes the window:

$(document).ready(function(){

    resizeDiv();

    $(window).resize(function(){
        resizeDiv();
    });

 });

You can see this in action in this demo page I posted (resize window to test): http://www.meiaweb.com/test/BMS_DM_NI/

alexmeia
A: 

if I m not wrong and your content is only text you can add wrap property although this dosen't work in firefox u can add wbr to your text

Vinay Pandey