I have 4 different divisions named outer
, inner
, title
, and content
. My goal is to place the inner
div inside the outer
div, with both the title
and content
divs positioned within the inner
div, one above the other. I have set the outer and inner divs to be positioned relative, while the title and content divs are positioned absolute.
The issue I am facing is that the title
and content
divs overflow out of the boundaries of the inner
div.
Could you please provide me with guidance on how to correct this CSS problem?
#outer {
width: 90%;
margin: 20px auto;
border: 2px solid red;
height: 500px;
position: relative;
}
#inner {
width: 100%;
border: 1px solid green;
height: 300px;
position: relative;
}
#inner .title {
width: 100%;
height: 63px;
padding-left: 1%;
padding-top: 5px;
border-radius: 2px;
float: left;
border: 1px solid blue;
background-color: lightblue;
position: absolute;
top: 0;
}
#inner .content {
padding: 2em 2em;
width: 100%;
height: 100%;
margin: 0 auto;
background: #FFF;
height: auto;
display: block;
float: left;
border: 2px solid orange;
position: absolute;
top: 20%;
}
<div id="outer">
<div id="inner">
<div class="title"></div>
<div class="content"></div>
</div>
</div>