如何:背景图像应保持静态,但其上的网页必须在asp.net中向下滚动

时间:2012-12-11 09:10:29

标签: asp.net html css web

我的网站需要这个。 背景图片应保持静态,但其上的网页必须在asp.net中向下滚动

<head runat="server"> <title></title>

   <style type="text/css"> 
    body { background-image: url('~/saibaba.jpg'); 
    background-repeat: no-repeat;
     background-position: center center; 
    background-attachment: fixed; } 
    #form2 { font-weight: 700; }
     </style>
     </head>

这是我的代码仍无效

3 个答案:

答案 0 :(得分:1)

body { background-attachment: fixed; }

答案 1 :(得分:0)

有关放置背景图像的其他方法,请查看Chris Coyiers全屏图像

http://css-tricks.com/perfect-full-page-background-image/

它为我工作

答案 2 :(得分:0)

尝试将CS​​S代码与主页分开。将所有CSS代码放在.css文件中,该文件可以在主页面中调用。试试这段代码 - &gt;&gt;

background-image:url('path_of_file_be_sure');
background-attachment:fixed;
background-repeat:no-repeat;
background-position:center