Link to home
Start Free TrialLog in
Avatar of YZlat
YZlatFlag for United States of America

asked on

Inner div overflows the outer as content grows

I have an outer div and inner div and if I do not set outer div min-height, inner div appears outside of the outer, but if I set the height of outer in my css, and the content of inner div grows larger, it overflows the outer div. How can I ensure the outer div grows with the inner div?

    <body>
		<div id="outer">
			<div id="inner">
				<div class="title">
					
					Title here
					
				</div>
				<div class="content"></div>

			</div>
		</div>

	</body>

Open in new window

Here is my css:
    #outer{
  		width:90%;
  		margin:20px auto;
	    height: 200px;
		border: 2px solid red;
        position: relative;
        padding: 0;
		}
		
		#inner{
  			width:98%;
			border: 2px solid green;
            position: absolute;
		}
		
		 #inner .title{
 			width:100%;
  			height:63px;
  			background:#80c0ff;
  			color:#FFF;
            padding-top: 5px;
            border-radius: 2px;
		}
    .clear { clear: both; }


		#inner .content{
	      width: 98%;
	      padding:1% 1%;
  		  background:#FFF;
  		  height:auto;
  		  display:block;
          border: 2px solid orange;
          position: relative;
		}

Open in new window

Avatar of Peter Hart
Peter Hart
Flag of United Kingdom of Great Britain and Northern Ireland image

try setting the height of the outer div to 100%
ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of YZlat

ASKER

@chilternPC, when I do that, the inner div "jumps out" of the outer div, and outer div appears as a line on to[p of inner div
Avatar of YZlat

ASKER

Thank you!