【发布时间】:2014-03-07 04:08:44
【问题描述】:
我无法使用 h1 元素创建具有全屏 div 的页面。
IE 和 Chrome 按预期正确呈现以下页面:包含红色全屏 div,没有滚动条:
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>title</title>
<style>
html {
background-color: purple;
}
body {
background-color: blue;
height: 100%;
margin: 0;
}
#main {
background-color: red;
min-height: 100%;
}
</style>
</head>
<body>
<div id="main">
<h1>
some text
</h1>
</div>
</body>
</html>
但是,对于 Firefox (27.0.1),我发现:
- 在页面顶部显示紫线
- 和垂直滚动条
- 如果我在 h1 元素之前直接向 #main div 添加一些文本,则页面会按预期呈现。
我应该怎么做才能在 FireFox 中正确渲染它,只在 h1 中使用文本?
【问题讨论】:
标签: html css fullscreen