[英]Space between footer and content
I'm trying to remove the space between my content and the footer. 我正在尝试删除内容和页脚之间的空间。 Still learning to use HTML so any help will be appreciated.
仍在学习使用HTML,因此将不胜感激。
#foot {
width: 1536px;
clear: both;
background-color: #800000;
height: auto;
}
Hey just saw your HTML and I think I understand your problem now, You want your Content and Footer to have no space at all right? 嘿,刚刚看了您的HTML,我想我现在就明白了您的问题,您希望您的Content和Footer完全没有空间吗? The reason it gets a space after adding a H1 element is that H1 element by default has a margin property.
添加H1元素后获得空格的原因是默认情况下H1元素具有margin属性。 You can override that by giving it 0 margin in CSS
您可以通过在CSS中为其设置0边距来覆盖它
h1 {
margin:0px
}
Check out this fiddle to see the difference. 看看这个小提琴,看看有什么不同。 http://jsfiddle.net/6fuk2g8d/1/ Let me know if that helps.
http://jsfiddle.net/6fuk2g8d/1/让我知道是否有帮助。
Hello there I'm still new at this too, but maybe this is what you meant. 您好,我对此还是很陌生,但也许这就是您的意思。
<div id="content">
<h1>
CONTENT
</h1>
</div>
<footer>
<h1>
FOOTER
</h1>
</footer>
#content {
padding: 10px;
background-color: red;
height: 200px;
}
footer {
padding: 10px;
transform: translateY(-21px);
clear: both;
background-color: black;
color: white;
}
please check this jsfiddle http://jsfiddle.net/gyptzxev/ 请检查此jsfiddle http://jsfiddle.net/gyptzxev/
I see that at first after putting an h1
element inside a footer make the space between div
content. 我看到,首先在将
h1
元素放在页脚内之后,在div
内容之间留出空格。 so in css I put transform: translateY(-21px);
所以在CSS中,我将
transform: translateY(-21px);
and the space between is gone. 和之间的空间不见了。 Still I know there are better ways to do this.
我仍然知道有更好的方法可以做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.