[thelist] DIVs with height not expanding vertically

M. Seyon evoltlist at delime.com
Mon Mar 14 13:36:37 CST 2005


Message from Ian Anderson (3/14/2005 05:52 AM)
>Greetings all - lovely morning here in the UK
>
>Wondered if anyone could offer any guidance with this; DIVs not expanding 
>vertically as the content grows if they have their height set through CSS.
>
>I am creating areas containing company details, enclosed in a DIV tag like 
>this;
>
><div>
><p>Company Name</p>
><p>Address 1</p>
><p>Address 2</p>
><p>County</p>
><p>Postcode</p>
><p>Phone</p>
><p>Email</p>
><p>Web address</p>
></div>
>
>I'm sure you know the sort of thing. Not all companies (records in DB) 
>have all fields. Most have very few, and the information is displayed 
>closed-up so there are no annoying gaps. All good so far.
>
>For design reasons, the DIV has a fixed height and a coloured background. 
>Again, for design reasons and efficient use of space, the height is set to 
>a sort of average amount. Most entries have space at the bottom of the div 
>and it looks nice.
>
>Should there be *more* entries than the height allows, in IE6 for Windows 
>the DIV is shown to expand vertically to accomodate them. BUT in Firefox 
>and Safari, the box remains the specified size, and the content overflows 
>down into the surrounding area.This also happens when the text size is 
>increased in the browser in any fixed height DIV on the page.
>
>I was astonished to read (forget where) that the IE behaviour is wrong 
>here, and that Firefox and Safari are behaving to spec.
>
>Can anyone verify that this behaviour is as intended?

I'm astonished that you're astonished. That's the way it works for width, 
why should it be any different for height.

Anyways Gunlaug answered all the important stuff. But have you also 
considered using overflow: auto? This will maintain the div dimensions, but 
place a vertical (and/or horizontal) scroll bar where necessary.

regards.
-marc

PS really, those useless tips are quite uncalled for. If you know they're 
not going to be of use to anyone at least hack the tip tag, like <t1p> for 
example so that it doesn't get archived by the tip harvester.

--
Trinidad Carnival in all its photographic glory. Playyuhself.com
http://www.playyuhself.com/


More information about the thelist mailing list