Jump to content
  • 0

div с фиксированной высотой, нужно сделать футер


maximt
 Share

Question

есть div с фиксированными высотой и шириной.

внутри 3 дива - заголовок, контент, футер.


<div class="container">
<div class="header">
title
</div>
<div class="content">
item content
</div>
<div class="footer">
toolbar
</div>
</div>

нужно сделать, чтобы футер был снизу, а контент занимал все свободное пространство между заголовком и футером.

прижал футер к низу так:


.container{
position:relative;
}
.footer{
position: absolute;
bottom: 0;
}

но с контентом не могу сообразить как..

upd

забыл один важный момент: div с контентом должен быть с overflow:hidden. т.е. содержимое дива не должно растягивать див-контейнер.

Edited by maximt
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

html {
height: 100%;
}
body {
width: 100%;
height: 100%;
}
#wrapper {
width: 1000px;
margin: 0 auto;
min-height: 100%;
height: auto !important;
height: 100%;
}
#header {
height: 150px;
}
#content {
padding: 0 0 100px;
}
#footer {
width: 1000px;
margin: -100px auto 0;
height: 100px;
}

<div id="wrapper">
<div id="header"></div>
<div id="content"></div>
</div>
<div id="footer"></div>

Удачи.

Edited by Bonzash
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