页脚不是';t在底部显示 由于某种原因,我的页脚浮动在页面中间。把我逼疯了。我希望这只是一个快速修复。我在网上看了看,所有的答案似乎都指向有一个固定的页脚,我不希望这样,因为它以更小的分辨率显示出来 <!DOCTYPE html> <html> <head> <title>MM Web Design</title> <meta name="viewport" content="width=500, initial-scale=1"> <link rel="stylesheet" href="css/style.css" /> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'> </head> <body> <img class="logo" src="img/logo.png"> <div class id="nav"> <ul> <li>Contact</li> <li>About</li> <li>Work</li> <li>Home</li> </ul> <br> </div> <div class="wrapper"> <h1>Welcome to my Portfolio</h1> <p> yada yada yada </p> <div class="row"> <div class="side-bar"> <h3> Recent Work </h3> <p>Here's some of my latest work, covering web design, branding and identity.</p> <a href="#">View the Portfolio →</a> </div> <div class="recent-wrap"> <a href="#"><img src="img/body-metrix.png"></a> <a href="#"><img src="img/body-metrix-logo.png"></a> <a href="#"><img src="img/market.png"></a> </div> </div> <div class="footer-wrap"> <div class="footer"> <ul> <li>Contact</li> <li>About</li> <li>Work</li> <li>Home</li> </ul> </div> </div> </body> </html>
很可能,它只是显示在其他div的下方 试试粘脚页脚不是';t在底部显示 由于某种原因,我的页脚浮动在页面中间。把我逼疯了。我希望这只是一个快速修复。我在网上看了看,所有的答案似乎都指向有一个固定的页脚,我不希望这样,因为它以更小的分辨率显示出来 <!DOCTYPE html> <html> <head> <title>MM Web Design</title> <meta name="viewport" content="width=500, initial-scale=1"> <link rel="stylesheet" href="css/style.css" /> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'> </head> <body> <img class="logo" src="img/logo.png"> <div class id="nav"> <ul> <li>Contact</li> <li>About</li> <li>Work</li> <li>Home</li> </ul> <br> </div> <div class="wrapper"> <h1>Welcome to my Portfolio</h1> <p> yada yada yada </p> <div class="row"> <div class="side-bar"> <h3> Recent Work </h3> <p>Here's some of my latest work, covering web design, branding and identity.</p> <a href="#">View the Portfolio →</a> </div> <div class="recent-wrap"> <a href="#"><img src="img/body-metrix.png"></a> <a href="#"><img src="img/body-metrix-logo.png"></a> <a href="#"><img src="img/market.png"></a> </div> </div> <div class="footer-wrap"> <div class="footer"> <ul> <li>Contact</li> <li>About</li> <li>Work</li> <li>Home</li> </ul> </div> </div> </body> </html>,html,css,footer,Html,Css,Footer,很可能,它只是显示在其他div的下方 试试粘脚 <div class="page-wrap"> Content! </div> <footer class="site-footer"> I'm the Sticky Footer. </footer> div的行为完全是他们应该做的?而且它们的顺序是正确的。 一旦您将内容填充到前面的div中,页脚就会向下移动 如果您希望它停留在窗口底部,那么它需要像已经建议的那样具有
<div class="page-wrap">
Content!
</div>
<footer class="site-footer">
I'm the Sticky Footer.
</footer>
div的行为完全是他们应该做的?而且它们的顺序是正确的。 一旦您将内容填充到前面的div中,页脚就会向下移动
如果您希望它停留在窗口底部,那么它需要像已经建议的那样具有粘性。请也包括您的CSS。你到底想完成什么?不管有多少内容,页脚都会粘在页面底部?你可以制作其中一个(查找粘性页脚),而不会让它看起来“在较小的分辨率下很糟糕”。@TylerH我只需要页脚在页面上的所有内容之后,这样它就位于页面底部,就像缺少了div一样。只是漂浮在页面的中间,嗯…在黑暗中拍摄,但尝试将
clear:both
添加到footer元素?我猜您需要清除所有的浮动。您可以将完整的代码发布到Codepen或jsfiddle,然后我将其排序:)
<div class="page-wrap">
Content!
</div>
<footer class="site-footer">
I'm the Sticky Footer.
</footer>
* {
margin: 0;
}
html, body {
height: 100%;
}
.page-wrap {
min-height: 100%;
/* equal to footer height */
margin-bottom: -142px;
}
.page-wrap:after {
content: "";
display: block;
}
.site-footer, .page-wrap:after {
/* .push must be the same height as footer */
height: 142px;
}
.site-footer {
background: orange;
}