Forum Moderators: not2easy

Message Too Old, No Replies

div max height

setting a div max-height

         

fmaz

12:16 am on Nov 19, 2004 (gmt 0)

10+ Year Member



Ok, I've a div, that have about 20 lines (1 link per line) inside.

This is a kind of menu.
I want to put the max-height of the div to 20px.

This way, when user click on the first link (who's "Show Menu") the div size goto 500px.

I've tried to set height:20px; but the content is still all visible!

SuzyUK

7:51 am on Nov 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fmaz..

you will need to control the overflow property too.

although you div itself is only 20px high the content of the div will, by default, overflow the 20px boundary (or in IE it will stretch it), try putting a temp background color on the div to see the difference between stretching and overflowing.

But if you explicitly set the overflow to hidden it should be fine..

#menuhide {
background: #ffc; /* temporary */
height: 20px;
/* height: auto; */ /* toggle value - or your 500px; */
overflow: hidden;
}

Suzy