gpt4 book ai didi

html - 将 div 扩展到屏幕尺寸之外

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

我的问题是特定于背景图像的。我已经将背景图像应用到 body 并将其水平居中。对于每一页,我将在标题下方添加一个段落,每个段落的大小都会不同,从而导致滚动。背景图像必须排在段落后面,但我无法使正文标签扩展以包含该段落,这意味着当您向下滚动时背景图像会被切断。我不想设置特定的高度,因为这会使页面滚动到段落之外。我已经尝试了几乎所有我能想到的相对位置/绝对位置和高度/最小高度的组合。

<html>
<body>
<div class="paragraph">
<p>text!</p>
</div
</html>

CSS

html {
background: url('/images/bg.png');
margin: 0;
padding: 0;
height: 100%;
min-height: 100%;
}

body {
margin: 0;
padding: 0 0 50px 0;
background-image: url('../images/fullheader.gif');
background-position: center 20px;
background-repeat: no-repeat;
position: absolute;
top: 0px;
bottom: 0px;
right: 0px;
left: 0px;
min-height: 100%;
}

.paragraph {
width: 640px;
padding: 10px 20px;
margin: 400px auto 0 auto;
min-height: 100%;
}

如果有帮助,我可以发布屏幕截图。

最佳答案

像这样给body添加css

       body {
background:#fff url(background.jpg) repeat-y top center;
margin:0px;
padding:0px;
}

关于html - 将 div 扩展到屏幕尺寸之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16191408/

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