简体   繁体   English

添加固定的背景图像并将前div滚动到html页面

[英]Adding fixed background image and scrolling front div to an html page

I am trying to add the fixed background to html page using css which have scrolling front div. 我正在尝试使用具有滚动前div的css将固定背景添加到html页面。 But after doing this my JavaScript form not gets loaded. 但是这样做之后,我的JavaScript表单没有被加载。 but when I remove that image and clear the css everything works well, 但是当我删除该图像并清除CSS时,一切正常

style.css after adding bg image: 添加bg图片后的style.css:

html{
width:100%;
height:100%;
position:fixed;
background: url('../images/bg.png') no-repeat center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}

body{
}
.wrap {
position:absolute;
width:100%;
overflow:scroll;
}

But when I clear it everything works well, 但是当我清除所有内容后,

html{
}
body{
}
.wrap {
}

Please see attached images, 请查看所附图片,

一种

and

在此处输入图片说明

background-position: fixed;

instead of 代替

position: fixed;

EDIT: Although Im not sure I understand your question entirely. 编辑:虽然我不确定我是否完全理解您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM