Как растянуть div между нижней и верхней панелью?
WEB странница состоит из трех элементов
I - верхняя панель <div> прижатая к потолку страницы (style="position:absolute; top:0px;") II - нижняя панель <div> прижатая к низу страницы (style="position:absolute; bottom:0px;") III - <div name="content" style="overflow-y: scroll;"> с контентом который находится между верхней и нижней панелью Как растянуть <div name="content"> четко между верхней и нижней панелью? |
А высота есть у верха и низа?
|
Цитата:
|
shurik_shink,
<body>
<style>
body {
position: relative;
margin: 0;
padding: 0;
min-height: 100%;
}
div {
border: 1px solid black;
width: 100%;
box-sizing: border-box;
text-align: center;
}
#header {
position: absolute;
top: 0;
height: 1.5em;
}
#content {
padding: 1.5em 0;
min-height: 100%;
}
#footer {
position: absolute;
bottom: 0;
height: 1.5em;
}
</style>
<div id="header">Header</div>
<div id="content">Content</div>
<div id="footer">Footer</div>
</body>
|
destus,
может добавить
html, body{
height: 100%;
}
иначе не растянет |
destus,
а зачем строка 21? |
рони,
чтоб не наезжал на шапку и подвал |
destus,
не танцует у меня твой пример |
Цитата:
С min-height не растягивает |
destus,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style>
html, body{
height: 100%;
}
body {
position: relative;
margin: 0;
padding: 0;
min-height: 100%;
}
div {
border: 1px solid black;
width: 100%;
box-sizing: border-box;
text-align: center;
}
#header { background-color: #008000;
position: absolute;
top: 0;
height: 1.5em;
}
#content { background-color: #FFD700;
min-height: 100%;
}
#footer { background-color: #00BFFF;
position: absolute;
bottom: 0;
height: 1.5em;
}
</style>
</head>
<body>
<div id="header">Header</div>
<div id="content">Content</div>
<div id="footer">Footer</div>
</body>
</html>
|
| Часовой пояс GMT +3, время: 15:53. |