问题:我不知道如何在使用reset.css
时更改页脚的高度,页脚div的height属性不会更改任何内容。
您可以在本地克隆此文件,然后check it out here
HTML
<div class="wrapper">
<p>Your website content here.</p>
</div>
<div id="footer">
<p>© 2013 Friend | Design and Development. All Rights Reserved.</p>
</div>
CSS - style.css
html, body {
height: 100%;
font-family: 'Arial', Helvetica;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -4em;
}
#footer {
background: #444444;
height: 100px;
font-family: 'Open Sans', sans-serif;
color: #FFFFFF;
padding: 20px;
}
RESET.css
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
3条答案
按热度按时间j13ufse21#
如果您将
.wrapper
上的负底部边距与页脚的高度相匹配,则应显示整个页脚。或者,如果你想要一个浮在页面底部的页脚,你可以这样做:
匹配
.content
填充的高度bfnvny8b2#
当你定义页脚的时候,
http://plnkr.co/edit/ULC8NHYMqmP240OW2z1d?p=preview
pzfprimi3#
在Chrome 27中,.wrapper的底部边距限制了#footer的可见高度。当height属性增加时,页脚确实会变高,但是额外的高度(在.wrapper的4em值之外)被隐藏在初始视口高度之外。
因此,它完全按照指定的方式执行:.wrapper占据了viewport的底部4em以外的所有区域,而#footer有自己的高度,与4em无关。