Jump to content
  • 0

Полоса прокрутки в блоке и его высота


NoItemName
 Share

Question

Возникла проблема. Уже несколько дней пытаюсь найти ответ, но без результата.

Хоту сделать страницу, в которой футер прикреплен к низу браузера (с этим проблем нет) и контент которой прокручивается полосой прокрутки. Но прокручивая не всю страницу, а только блок с контентом (шапка, футер оставались не подвижными).

Как указать высоту блока .content, чтоб он вытягивался до футера?


@charset "utf-8";
/* CSS Document */
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -175px;
}
.footer, .push {
clear: both;
height: 175px;
}
.content{
overflow-y: scroll;
height: 200px;
}


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="wrapper">
<div class="content">
<p>qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
qwe текст<br>
</p>
</div>
<div class="push"></div>
</div>
<div class="footer">
<p>футер</p>
</div>
</body>
</html>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

В общем, нашел решение. Автор некий pepelsbey.


<!DOCTYPE HTML>
<html lang="ru-RU">
<head>
<title></title>
<meta charset="UTF-8">
<style>
BODY {
overflow:hidden;
padding:0;
margin:0;
}
#header {
position:absolute;
top:0;
left:0;
width:100%;
height:40px;
background:#666;
}
#content {
position:absolute;
top:40px;
bottom:40px;
left:0;
width:100%;
overflow:auto;
background:#CCC;
}
#footer {
position:absolute;
bottom:0;
left:0;
width:100%;
height:40px;
background:#666;
}
</style>
</head>
<body>
<div id="header"></div>
<div id="content">

</div>
<div id="footer"></div>
</body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy