cwiggo
cwiggo

Reputation: 2609

Outer Div not expanding with Inner Div

I am developing the follow page:

The problem i'm having is the tabular structure. The outer div, my container is not expanding with the alternating heights of the tabs. See image of problem:

enter image description here

I would like the container to extend to the tabs heights.

HTML:

<section class="x_section_wide">
<div id="ambition_container">
    <div id="x_tools">
        <span id="a_name">name</span>           
    </div>
    <div class="x_content">
        </div>
        <div id="a_progress_bar">
            <span id="a_progress">
            </span>
        </div>
        <div class="tabs">
           <div class="tab">
               <input type="radio" id="tab-4" name="tab-group-2" checked>
               <label for="tab-4" id="a_tab_one">1</label>
               <div id="tab_information" class="tab_content">
                   <div id="a_extra_info">
                        <div id="a_extra_info_inner">
                            <div>1</div>
                            <div>1</div>
                            <div>1</div>
                            <div>1</div>
                            <div>1</div>
                            <div>1</div>
                            <div>1</div>
                            <div>1</div>
                        </div>
                    </div>
               </div> 
           </div>
           <div class="tab">
                <input type="radio" id="tab-5" name="tab-group-2">
                <label for="tab-5" id="a_tab_two">2</label>
                <div id="tab_evidence" class="tab_content">
                    <div id="a_evidence">
                        <div id="a_evidence_inner">
                            2
                        </div>
                    </div>
                </div> 
           </div>
            <div class="tab">
               <input type="radio" id="tab-6" name="tab-group-2">
               <label for="tab-6" id="a_tab_three">3</label>
               <div id="tab_comments"class="tab_content">
                    <div id="a_comments">
                        <div id="a_comments_inner">
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                            <p>3</p><br/>
                        </div>
                    </div>
               </div> 
           </div>
            <div class="tab">
               <input type="radio" id="tab-7" name="tab-group-2">
               <label for="tab-7" id="a_tab_four">4</label>
               <div id="tab_supporters" class="tab_content">
                    <div id="a_supporters">
                        <div id="a_supporters_inner">
                            4
                        </div>
                    </div>
               </div> 
           </div>
        </div>
    </div>
</div>

The CSS used for this particular page is:

#a_extra_info, #a_evidence, #a_comments, #a_supporters{
padding:30px;
}

#a_extra_info{
background-color: #E29FA4;
}

#a_evidence{
background-color: #B98489;
}

#a_comments{
background-color: #845F64;
}

#a_supporters{
background-color: #5E4549;
}

#a_extra_info_inner, #a_evidence_inner, #a_comments_inner, #a_supporters_inner{
background-color: #FFF;
/*padding: 10px;*/
}

#a_extra_info_inner span, #a_extra_info_inner label, #a_evidence_inner span, #a_evidence_inner label, #a_comments_inner span, #a_comments_inner label, #a_supporters_inner span, #a_supporters_inner label{
color: #000;
}

.tabs {
position: relative;   
min-height: 276px; /* This part sucks */
clear: both;
}
.tab {
float:left;
width: 25%;
}
.tab > label {
text-align: center;
position: relative;
height:30px;
line-height: 30px;
font-weight: normal;
font-size: 100%;
cursor: pointer;
margin:0;
}
.tab [type=radio] {
display: none;   
}
.tab_content {
position: absolute;
top: 28px;
left: 0;
right: 0;
bottom: 0; 
}
[type=radio]:checked ~ label {
z-index: 2;
}
[type=radio]:checked ~ label ~ .tab_content {
    z-index: 1;
}

#a_tab_one{
background-color: #E29FA4;
color:#000;
}
#a_tab_two{
background-color: #B98489;
color:#000;
}
#a_tab_three{
background-color: #845F64;
}
#a_tab_four{
background-color: #5E4549;
}

Is there a solution for this? Please see the link for a better view of the problem.

Thanks

Upvotes: 2

Views: 1842

Answers (3)

Manuel B&#233;cares
Manuel B&#233;cares

Reputation: 88

#ambition_container, #tabs{
overflow:hidden;
}

Add this rules on your CSS stuff.

Upvotes: -1

saman khademi
saman khademi

Reputation: 842

you must change like this
for tabs

<div class="tabs">
  <div class="tab">
  <div class="tab">
  <div class="tab">
  <div class="tab">
</div>

css of tabs

.tabs {
    clear: both;
    height: 30px;
    position: relative;
}

and place content after tabs in content div

<div class="content" style="">
    <div id="tab_information for tab1" class="tab_content" style="display: block;">
        <div id="a_extra_info">
            <div id="a_extra_info_inner">Place Content of tab 1</div>
        </div>
    </div>
    <div id="tab_information for tab2" class="tab_content" style="display: none;">
        <div id="a_extra_info">
            <div id="a_extra_info_inner">Place Content of tab 2</div>
        </div>
    </div>
</div>

Upvotes: 2

SuRaj Creator
SuRaj Creator

Reputation: 995

set this style on your outer div id or class whatever you have

#ambition_container{
    background-color: #461f20;
    padding:20px 10px 10px 10px;
    position:relative;
    height:100%;
    overflow-y:auto;
    display:block
}

Upvotes: 3

Related Questions