【发布时间】:2014-02-03 18:33:28
【问题描述】:
我正在创建一个简单的响应式 html 模板,它只有 3 行,页眉、正文、页脚和页脚和页眉的图像,以及正文的背景图像。现在我的页脚没有固定在底部,我希望我的最大高度为 1024 像素。
这是一张应该是什么样子的图片:
这就是我得到的:
我不知道我的代码出了什么问题...我尝试了许多 css 组合。
这是我的完整代码:
<!doctype html>
<html>
<head>
<title>Put your title here</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
html, body {
margin: 0;
padding: 0;
width: 100%;
max-height: 1024px;
background-image: url(landing-page3.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
}
.wrapper {
height: 100%;
}
.main {
height: 70%;
}
.header {
height: 15%;
}
.footer {
height: 15%;
}
</style>
</head>
<body>
<div id="wrapper" class="wrapper">
<div id="header">
<img src="headerf.png" style="width:100%;">
</div>
<div id="main">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
<div id="footer">
<img src="footer.png" style="width:100%; position: absolute; bottom: 0;">
</div>
</div>
</body>
</html>
【问题讨论】:
标签: html css sticky-footer