我想要做的是背景圖像填充整個頁面,但有能力向下滾動,並沒有圖像永遠持續下去。如果我將圖片添加到div背景大小的封面不起作用,我需要添加高度和寬度,這看起來並不理想。英雄形象 - 不知道如何表達這
body {
\t background-image: url("http://cdn.wallpapersafari.com/66/90/zq7i3T.jpg");
\t background-size: cover;
\t background-repeat: no-repeat;
\t background-attachment: fixed;
}
h1 {
\t color: white;
\t font-size: 50px;
\t text-align: center;
\t position: relative;
\t top: 2000px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Luke Hayes</title>
</head>
<body>
<div class="hero">
\t <h1>Some testing text</h1>
</div>
</body>
</html>
請提供的jsfiddle。所以我可以理解你想要什麼? –
background-size:100%100%; – pol
@Raziasultana https://jsfiddle.net/4ujx31aa/我把H1幾千個像素向下展示我的意思是永遠背景圖像。 –