gpt4 book ai didi

javascript - 整个
元素的背景图片

转载 作者:行者123 更新时间:2023-11-28 03:52:23 26 4
gpt4 key购买 nike

我的目标是在整个 <main> 上有一个背景图片元素但 <main>元素没有扩展到页面底部(或者在我的情况下扩展到页脚)我能做什么因为 <main>只是在页面中间结束?

html {
height: 100%;
box-sizing: border-box;
}
body {
background-color: #f5f5f5;
margin: 0;
padding: 0;
position: relative;
min-height: 100%;
}

/* ---------------------------------------------------------------- */
#fullmain {
padding-top: 109px;
padding-bottom: 86px;
text-align: center;

background: #f5f5f5 url(" http://pre06.deviantart.net/2bf3/th/pre/i/2010/284/b/d/autumn_fortest_ii_by_lotusonlinede-d30jn9b.jpg") no-repeat center center;
background-size: cover;
min-height: 100%;


}


#header {
background-color: #25211e;
border-bottom: 6px solid #1d1a18;
text-align: center;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 103px;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
z-index: 99;

}

#heading {
font-family: "titlefont";
color: #c1b497;
font-size: 45px;
display: inline-block;
margin-bottom: 10px;
margin-top: 15px;
}

/* ---------------------------------------------------------------- */


#footer {
background-color: #25211e;
border-top: 6px solid #1d1a18;
text-align: center;
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 80px;
z-index: 98;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}

#credit {
font-family: "Helvetica";
font-size: 14px;
color: #c1b497;
font-weight: 600;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Page</title>
</head>
<body>
<div id="all">
<header id="header">
<h1 id="heading">My Page</h1>
</header>
<main id="fullmain">
</main>
<footer id="footer">
<p id="credit">Footer</p>
</footer>
</div>
</body>
</html>

最佳答案

您也忘记将#all 标签设置为高度 100%

#all {
height: 100%;
}

享受=]

关于javascript - 整个 <main> 元素的背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43660819/

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