我在页脚下面有一个白色空间有问题。我已经在Stack Overflow上搜索过,似乎无法找到适合我的答案,所以希望有人可以帮我解决我的具体问题。
我注意到的事情:
<%= yield %>
代码以查看它是否是来自其他网页/部分的空格,但在删除<%= yield %>
代码后仍留有空格。 application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>DoINeedAJacket</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<div class="wrapper">
<%= yield %>
<div class="push"></div>
</div>
<div class="footer">
<ul>
<%= link_to image_tag('facebook-1.png', size: '32x32'), '####' %>
<%= link_to image_tag('twitter-1.png', size: '32x32'), '####' %>
<%= link_to image_tag('linkedin-1.png', size: '32x32'), '####' %>
<%= link_to image_tag('github-1.png', size: '32x32'), '####' %>
</ul>
</div>
</body>
</html>
application.css.scss
* {
margin: 0;
}
html {
height: 97%;
}
body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -3em;
}
.footer, .push {
height: 3em;
text-align: center;
ul {
padding: 0;
margin-bottom: 0;
img {
margin: 0.5rem;
}
}
}
我将身高设置为97%的原因是因为我需要摆脱一些滚动空间。如果有更好的方法,请告诉我。
谢谢!
答案 0 :(得分:1)
将position:relative;
添加到.wrapper
position:absolute;
bottom:0;
到你的footer
答案 1 :(得分:0)
这是页脚没有边距的CSS(没有SCSS,只有CSS):
* {
margin: 0;
}
html, body { margin: 0; padding: 0; }
html {
height: 97%;
}
body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -3em;
}
.footer, .push {
height: 3em;
text-align: center;
}
.footer {
position: absolute;
width: 100%;
bottom: 0;
padding-bottom: .5rem;
}
.footer ul, .push ul {
padding: 0;
margin-bottom: 0;
}
.footer ul img, .push ul img {
margin: 0.5rem;
}