简体   繁体   English

html/css页脚未定位

[英]html/css footer not positioning

So basically I made a footer and when I make it smaller, white space appears under it and the smallest size without the white space is 40px (what is way to big for my site).所以基本上我做了一个页脚,当我把它变小时,它下面会出现空白,没有空白的最小尺寸是 40px(对我的网站来说是多大的方式)。 Anyone know what I've done wrong and I've also been trying to add a copyright under the nav,but it just gets placed on-top of it no matter what I change!任何人都知道我做错了什么,我也一直试图在导航下添加版权,但无论我更改什么,它都会被放置在它上面!

 header:after, section:after, article:after, footer:after, #navigation-top:after, #navigation-bottom:after, #page-header-wrapper:after, #banner-area-wrapper:after, #page-body-wrapper:after, #page-footer-wrapper:after, .clearer:after { content: ""; display: table; clear: both; width:960px; margin:0 auto; } footer nav { float:left; } footer nav ul li { display: inline-block; margin-left:10px; list-style: none; } footer nav ul li a { font-family: tpeb; font-size:12px; color: #fff; text-align: center; } footer { width:100%; background-color: #292929; padding:40px 0px; }
 <footer> <div class="wrapper"> <p> <nav> <ul> <li><a href="index.html">HOME</a></li> <li><a href="anime.html">ANIME</a></li> <li><a href="manga.html">MANGA</a></li> <li><a href="forums.html">FORUMS</a></li> <li><a href="faq.html">FAQ</a></li> <li><a href="contact.html">CONTACT</a></li> </ul> </nav> </div> </footer>

I can't tell from the HTML/CSS you've posted if you're site is too short height-wise (this can result in leftover white-space under your footer).我无法从您发布的 HTML/CSS 中判断您的站点是否在高度方面太短(这可能会导致页脚下方出现剩余的空白)。

When in doubt, if you really want your footer to be at the bottom of your page,如有疑问,如果您真的希望页脚位于页面底部,

footer {
    position:absolute;
    bottom:0;
/* anything else style-wise*/
}

Your您的

footer nav {
  float:left;
}

seems to be what's causing your copyright message to be pushed up.似乎是导致您的版权信息被推高的原因。 You could change it to:您可以将其更改为:

footer nav {
  left:0;
}

for a similar effect without the push up.在没有俯卧撑的情况下获得类似的效果。 Generally, avoid using 'float' in CSS if you find positioning issues.通常,如果您发现定位问题,请避免在 CSS 中使用“float”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM