Html 如何在滚动时将背景保持在固定位置
这是cssHtml 如何在滚动时将背景保持在固定位置,html,css,background-image,Html,Css,Background Image,这是css #bigwrapper{ background-image: url('http://www.w8themes.com/wp-content/uploads/2013/09/Water-Backgrounds.jpg'); background-repeat: no-repeat; background-position: fixed; width: 100%; } 这是html <body id="bigwrapper">...<
#bigwrapper{
background-image: url('http://www.w8themes.com/wp-content/uploads/2013/09/Water-Backgrounds.jpg');
background-repeat: no-repeat;
background-position: fixed;
width: 100%;
}
这是html
<body id="bigwrapper">...</body>
下面是html
<div id="title" class="header1">
<header><h1 ="title1" class="allTitle">The Water Project</h1></header>
</div>
水利工程
使用此样式:
#bigwrapper {
background-image: url('http://www.w8themes.com/wp-content/uploads/2013/09/Water-Backgrounds.jpg');
background-repeat: no-repeat;
background-position: top center;
background-attachment: fixed;
width: 100%;
}
你必须使用背景附件:固定代码>
background-attachment: fixed;
上面的线条将使背景图像固定
#bigwrapper{
background-image: url('http://www.w8themes.com/wp-content/uploads/2013/09/Water-Backgrounds.jpg');
background-repeat: no-repeat;
background-position: top left;
background-attachment: fixed;
width: 100%;
}
嗯,我在创作一把小提琴,在发帖前被转移了一段时间,看起来好像其他人打败了我。为了用我的作品做点什么,这里是小提琴
正如其他人所说,使用
background-attachment: fixed
在主体内部使用DIV并设置DIV的样式请参见我的答案。不需要使用DIV@user3612995:请看这个小提琴标记作为答案!!
background-attachment: fixed