gpt4 book ai didi

CSS 位置 :fixed overflow:auto

转载 作者:行者123 更新时间:2023-11-28 13:46:51 25 4
gpt4 key购买 nike

我想在页面底部放置一个div,并将其宽度设置为960px,在页面中央,到左边框的最小距离为170px。这是我的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
</head>
<style type="text/css">
body{width:100%;height:100%;}
*{padding:0;margin:0;}
#wrap{position:fixed;margin:0 auto;margin-left:170px;width:960px;overflow:auto;bottom:0;height:100px;}
</style>
<body>
<div id="wrap">
test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test&nbsp;test
</div>
</body>
</html>

但是当屏幕宽度为1024时,div#wrap没有滚动,右侧部分不显示。我该如何解决?

最佳答案

我想我理解了这个问题,但我仍然不清楚您要构建什么。

你应该改变

position : fixed;

到:

position : absolute;

这解决了您的滚动问题。

. . .

*注意:我也认为你可以删除

overflow: auto;

此外,更改:

body{ width:100%;height:100%; }

到:

html, body{ 
width:100%;
min-height: 100%;
height: auto !important;
height:100%;
}

关于CSS 位置 :fixed overflow:auto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4679864/

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