2015-03-19 75 views
0

我试图从它的当前位置拉伸div到页面的末尾。我该怎么做?这是我的代码:如何将div从某个位置拉伸到页面的底部?

<div style="text-align:center; font-weight:bold; font-size:small; background-color:Silver; position:absolute; width:100%">Copyright © Aradmey<br /><%= GetDomain() %></div> 

股利不放置在页面的顶部,它只是页脚,我不能得到它的工作的权利..

目前,该页面看起来像this 。我想它看起来像this,但没有它伸展到底部,它使它可以滚动。我希望它只有在尚未达到最低点时才能延伸。

回答

0

我会建议。

html,body{height: 100%;} 
 
.stretch{ 
 
    height: 100%; 
 
    display: table; 
 
    width: 100%; 
 
} 
 
.stretch .left{ 
 
    display: table-cell; 
 
    width: 40%; 
 
    background: #333; 
 
} 
 
.stretch .right{ 
 
    display: table-cell; 
 
    width: 60%; 
 
    background: #ccc; 
 
}
<div class="stretch"> 
 
    <div class="left"></div> 
 
    <div class="right"></div> 
 
</div>

+0

我不需要在同一行上有两个“div”。我需要一个div伸展到底部。 – 2015-03-19 10:31:23

+0

如果您不想要 只需移除一个div就可以移除一个div – Kumar 2015-03-19 10:37:45

0

在未来的HTML和CSS应该是在不同的班级是这样的: Fiddle

与我们的代码ü只需要添加 “底:0;”到你的风格:print

CSS 
#footer{ 
    text-align:center; 
    font-weight:bold; 
    font-size:small; 
    background-color:Silver; 
    position:absolute; 
    width:100%; 
    bottom: 0; 
} 

HTML 
<div id="footer">Copyright © Aradmey<br /><%= GetDomain() %></div>