anonf34
anonf34

Reputation: 313

set div style to max-height

I have a question about css styling, where I want to set max-height to outer . When I set only height it works fine, but when I want to set it to max-height the content of the inner disappears.

You can get the example here: http://sara.hil.ch/grega/example5.html

Any suggestions?

//outer div  style
 div.dogodkiinhalt {  
      position: relative; 
      top: 0px;   
      left: 0px;   
      width: 400px;  
      padding-bottom: 0px;
      background: blue; 
      border: none;  
      overflow: auto; 
      visibility: visible; 
      height: 200px;

    }
//inner div style
    #inhaltbox { 
      position: absolute;
      top: 0px; 
      overflow: hidden;
      width: 400px;
      height: 200px;
      display: none;
      display: block;
    }

Upvotes: 1

Views: 1013

Answers (1)

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114347

Yes, if you set max-height - what will the minimum height be? ZERO!

You need to set min-height or height as well.

Also, there are a few problems here.

 div.dogodkiinhalt {  
      position: relative; 
      top: 0px;   <-- not needed
      left: 0px;   <--- not needed
      width: 400px;  
      padding-bottom: 0px;
      background: blue; 
      border: none;  
      overflow: auto; 
      visibility: visible; <--- not needed 
      height: 200px;

    }
//inner div style
    #inhaltbox { 
      position: absolute;
      top: 0px; <--- left or right also needs to be declared
      overflow: hidden;
      width: 400px;
      height: 200px;
      display: none;  <---
      display: block; <--- Choose one, not both
    }

Upvotes: 1

Related Questions