gpt4 book ai didi

html - 在 2 个固定 DIV 之间滚动一个 div,位置 : does not work for me

转载 作者:行者123 更新时间:2023-11-28 05:34:24 25 4
gpt4 key购买 nike

我试图在两个固定 DIV(页眉和页脚)之间滚动内容。可滚动区域有一个固定的(子)标题和可变文本,这是我需要滚动的内容。我有一些方法,但现在卡住了。HTML 看起来像这样:

<link rel="stylesheet" type="text/css" href="css/template.css" />
<link rel="stylesheet" type="text/css" href="css/button.css" />
</head>
<body>
<div id="header-wrapper">
<div id="header">
<div id="toprightimage"><img src="images/topimage.png" alt="Nutwith Cote" title="Nutwith Cote" /></div>
<img id="topbordertext" img="" src="images/HPGtitle.png" alt="Panaramic view" title="HPG Name" />
</div><!-- end of id="header" -->
</div><!-- end of id="header-wrapper" -->

<div id="content-wrapper">
<div id="tabline">
<a href="#" class="Button">Home</a>
<a href="#" class="Button">About Us</a>
<a href="#" class="Button">Current Work</a>
<a href="#" class="Button">Achievements</a>
<a href="#" class="Button">Events</a>
<a href="#" class="Button">Publications</a>
<a href="#" class="Button">The Project</a>
<a href="#" class="Button">Methodology</a>
<a href="#" class="Button">Location map</a>
<a href="#" class="Button">Contact Us</a>
<a href="#" class="Button">Links</a>
</div><!-- end of id="tabline" -->
<div id="content">
First line of text: (extracted from http://lipsum.com/)
<!--#config errmsg="" --> <!--#include virtual="ZZ_BigLoremIpsum.txt" -->
Last line of text:
</div><!-- end of id="content" -->

</div><!-- end of div id="content-wrapper -->


<div id="footer-wrapper">
<!--#config errmsg="" --> <!--#include virtual="ZZ_dataserver.footer" -->
</div><!-- end of div id="footer-wrapper" -->

</body>

CSS 看起来像这样:

*   {
margin:0;}
body {
min-width:640px;}
/* Absolute positioned header for all browsers*/
#header-wrapper {
position:absolute;top:0;left:0;height:100px;}
/* Reset header position to fixed for real browsers such as Firefox*/
body>#header-wrapper {
position:fixed;}
#header {
height:100px;margin:0 auto;width:100%;position:fixed;}
#content {
padding-top:3px;}
#content-wrapper {
padding: 0;padding-top:130px;
padding-bottom:30px;position: static;}
body{
background-color:#66FFFF;
background-image:url('/images /gradient3.png');
background-repeat:repeat;margin-left: 5px;}
#footer-wrapper {
position:absolute;bottom:0;left:0;
background-color:#CCCCCC;height:30px;
border-top-style: solid;border-top-color: black;
border-top-width: 2px;width:100%;}
body>#footer-wrapper {
position:fixed;}
#tabline{
position:fixed;background-color:#F0F8FF;
top:100px;width:100%;padding-top:5px;
overflow: auto;border-style: solid;border-width: 1px;
border-color: #f9f9f9;}
#toprightimage {
position:fixed;}
#topbordertext {
bottom: 0;left: 0;margin: auto;position: absolute;right: 0;top: 0;}

让可变文本可见并滚动的唯一方法是填充 DIV(内容包装器),以便 txt 从制表符行下方开始。我看到的主要问题是,当页面缩小到标签行折叠的点时,折叠的标签会遮盖初始文本行。

使用 Firebug,我可以看到 DIV 似乎是从屏幕顶部(视口(viewport)?)锚定的,而我本以为它会从前面的 DIV(标线)下方开始。这就是我在例如 http://www.w3schools.com 中查找位置时读到的内容.

有人可以解释一下我做错了什么以及如何改正吗?

您可以通过这个 url 查看有问题的页面: hpg-nidderdale.co.uk/template.shtml

最佳答案

看看使用响应式设计怎么样

@media only screen and (max-width: 768px) { }

或任何导致菜单覆盖副标题的宽度并更改正文 padding-topmargin-top 以提供正确数量的像素,以便字幕显示。

滚动浏览本教程 (http://www.entheosweb.com/website_design/responsive_web_design.asp),您可以了解如何实现它以及您可以用它做些什么。

编辑:

尝试将其添加到您的 css 表中

@media only screen and (max-width: 810px) {
#content-wrapper {
margin-top: 30px;
}

}

@media only screen and (max-width: 434px) {
#content-wrapper {
margin-top: 60px;
}

}

关于html - 在 2 个固定 DIV 之间滚动一个 div,位置 : does not work for me,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38312975/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com