Reputation: 1833
JsFiddle: Here
So I've run into two problems and I can't seem to figure out the solutions. one: I need the content div's min height to be the height of the menu(I'd prefer not to use the min-height rule) two: when the content div is larger than the menu I need the menu's height to be the size of the content div.
HTML:
<div class="container">
<div class="menu">
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li>Menu3</li>
<li>Menu4</li>
</ul>
</div>
<div class="content">content</div>
</div>
<div class="container">
<div class="menu">
<ul>
<li>Menu1</li>
<li>Menu2</li>
<li>Menu3</li>
<li>Menu4</li>
</ul>
</div>
<div class="content">content2</div>
</div>
CSS:
.container{
padding: 5px 0;
clear: both;
}
.menu{
float:left;
background-color: green;
}
.menu ul{
list-style-type: none;
padding: 0;
margin:0;
}
.content{
background-color: yellow;
padding-left: 50px;
}
EDIT:
After messing around on jsFiddle I have come up with This, does anyone here seem to have a problem? Essentially it uses display table and display table row...
HTML:
<div class="table">
<div class="row">
<div class="cell first">
asdfasdf
</div>
<div class="cell second">
Content 1
</div>
</div>
</div>
<div class="table">
<div class="row">
<div class="cell first">
asdfasdf
</div>
<div class="cell second">
Cotent 2
</div>
</div>
</div>
CSS:
.table{
display table;
padding-top: 20px;
}
.row{
display: table-row;
}
.first{
background-color:green;
}
.second{
background-color:yellow;
width: 100%;
}
.cell{
display:table-cell;
}
Upvotes: 0
Views: 60
Reputation: 3124
If you want both columns to have equal heights, try the one true layout method:
/* CSS */
.container{
padding: 5px 0;
clear: both;
overflow: hidden;
}
.menu, .content {
padding-bottom: 999999px;
margin-bottom: -999999px;
}
.menu{
float:left;
background-color: green;
}
.menu ul{
list-style-type: none;
padding: 0;
margin:0;
}
.content{
background-color: yellow;
padding-left: 50px;
}
Upvotes: 1
Reputation: 115342
Min-content size....It's a matter of floats the menu and the content and apprppriate widths
NB. Equal height for the menu when the content is a different discussion with various solutions.
JSFiddle Demo (rough as I'd tidy up and use `box-sizing
.container{
padding: 5px 0;
clear: both;
background-color: yellow;
overflow:hidden;
margin-bottom:10px;
}
.menu{
float:left;
background-color: green;
width:10%;
}
.menu ul{
list-style-type: none;
padding: 0;
margin:0;
}
.content{
float:left;
width:80%;
margin-left:10px;
}
Upvotes: 0