gpt4 book ai didi

html - 使 html 主体足够大以容纳其中的内容

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

我目前正在为一个副元素开发网站,但我在网络开发方面没有太多经验。在过去的一个小时里,我一直在绞尽脑汁想弄清楚为什么我的页面是 <body>。元素仅呈现与我的视口(viewport)一样高,而不是足够高以包含其中的内容。结果是,当我向下滚动页面时,正文内的表格垂直溢出,正文的黑色背景明显在其中的内容之前结束。这是我的正文 CSS:

html 
{
background: url(../images/background.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body
{
width: 80%;
font-family: Verdana;
font-size: 14;
color: white;
background: rgba(0, 0, 0, .75);
margin-left: auto;
margin-right: auto;
}

不幸的是,我无法发布图片,但能够看到黑色内容背景的尽头并不是特别好看。

最佳答案

加入你的 body :

height: auto;

关于html - 使 html 主体足够大以容纳其中的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20929601/

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