Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在窗口高度后开始内容_Html_Css - Fatal编程技术网

Html 在窗口高度后开始内容

Html 在窗口高度后开始内容,html,css,Html,Css,我试图复制我经常在网页上看到的设计模式。我希望我的页面内容在窗口的全高之后开始。 我有一个标题,标题中有一堆链接,这些链接在我的屏幕上垂直和水平居中,我希望第一段不会显示在页面上(您应该滚动查看,您应该只在登录页面时才看到标题)。 我曾尝试将页边距顶部:100%应用于我的内容,但由于页眉高度已添加到页边距,因此页边距底部太远。 示意图上是这样的 <body> <!-- You can see this when you load the page --> <div

我试图复制我经常在网页上看到的设计模式。我希望我的页面内容在窗口的全高之后开始。
我有一个标题,标题中有一堆链接,这些链接在我的屏幕上垂直和水平居中,我希望第一段不会显示在页面上(您应该滚动查看,您应该只在登录页面时才看到标题)。
我曾尝试将
页边距顶部:100%
应用于我的内容,但由于页眉高度已添加到页边距,因此页边距底部太远。
示意图上是这样的

<body>
<!-- You can see this when you load the page -->
<div id="header">
blablabla 
<a href="">Index</a>
<a href="">Contact</a>
<a href="">...</a>
</div>

<!-- You should scroll to see this -->
<div id="content">
<p>...</p>
</div>
</body>

有关于如何做的提示吗?我经常在手机设计中看到这样的图案,但我从来没想过怎么做。我可以用javascript来做,但我认为有一种方法可以用纯css来做

使用
vh
装置
100vh
是视口的高度。这里有一个参考-

正文{
保证金:0;
}
#标题{
高度:100vh;
背景:#eee;
}

喋喋不休

var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var hheight = document.getElementById('header').offsetHeight;
document.getElementById("content").style.marginTop = (height - hheight)+ "px";