我无法在页面中心对齐隐藏的 div。
如果我将它们定位到 relative ,当我从一页移动到另一页时,滚动会增加(即 div 未与页面中心垂直对齐)
我应该将所有三个 div 放在一个容器 div 中吗?
请帮忙!!!
提前谢谢了..
<body>
<div id ="page1" class="page" style=""visibility:visible>
content
<!-- also contains a button that hides this div and makes the
next div visible -->
</div>
<div id="page2" class="page">
content
<!-- also contains two buttons for back and next div -->
</div>
<div id ="page3" class="page">
content
<!-- contains two buttons for back and submit -->
</div>
</body>
我使用的 CSS 是:
.page {
position: absolute;
visibility:hidden;
}
我使用的javascript是:
<script language="JavaScript">
var currentLayer = 'page1';
function showLayer(lyr){
hideLayer(currentLayer);
document.getElementById(lyr).style.visibility = 'visible';
currentLayer = lyr;
}
function hideLayer(lyr){
document.getElementById(lyr).style.visibility = 'hidden';
}
</script>