I want to design a structure for a web page but I have a problem that I can't sole it. This is what I want:
a web page with 3 parts:
1-header
2-content( has 2 parts, a sidebar and a content section)
3-footer
and I want these characteristics:
1- if in the content section there is nothing then footer stays at the bottom, if we have content, footer pushes down and stays after my content
2- my sidebar(exist in the content section) take 100% height of content section and connects to footer
like this:
I build this with this code and it works, but my problem is that if contents of sidebar area gets bigger, sidebar and main content area overlaps footer! I want that in this situation, footer stays after my content.
I use Twitter Bootstrap for my work. I don't want to use methods that are available only in the new browsers. at least IE 9.
this is my code:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap.min.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container-fluid">
<div class="row header">
<div>header</div>
</div>
<div class="row content">
<div class="col-lg-2 sidebar">
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
<div>content</div>
</div>
<div class="col-lg-10">content</div>
</div>
<div class="row footer">
<div>footer</div>
<div>footer</div>
<div>footer</div>
<div>footer</div>
<div>footer</div>
</div>
</div>
and this is CSS:
body,html{
height: 100%;
}
.container-fluid {
height:100%;
}
.header{
background-color: #ccff55;
}
.content{
background-color: #445566;
height: -webkit-calc(100% - 10%);
}
.sidebar{
background-color: #446655;
height: 100%;
}
.footer{
background-color: #11ff99;
}