首页 > 建站教程 > Div+Css >  background-attachment 网页背景固定正文

background-attachment 网页背景固定

右上固定:
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-position:100% 0%;
background-repeat:no-repeat;
background-attachment:fixed;}
-->
</style>
------------------------

右下固定:
<!--
body {

background-image:url("5.jpg");
background-position:100% 100%;
background-repeat:repeat-y;
background-repeat:no-repeat;
background-attachment:right bottom;
}
-->
------------------------

左上
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-repeat:no-repeat;
background-attachment:fixed;}
-->
</style>
------------------------

左下
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-position:0% 100%;
background-repeat:no-repeat;
background-attachment:fixed;}
-->
</style>
-------------------------

正中
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-repeat:no-repeat;
background-attachment:fixed;
background-position:center ;}
-->
</style>
-----------------------

右边
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-position:100% 0%;
background-repeat:repeat-y;
background-attachment:fixed;}
-->
</style>
------------------

左边
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-repeat:repeat-y;
background-attachment:fixed;}
-->
</style>
--------------

上边
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-repeat:repeat-x;
background-attachment:fixed;}
-->
</style>
-----------------------

下边
<style type="text/css">
<!--
body{
background-image:url("背景url");
background-position:bottom;
background-repeat:repeat-x;
background-attachment:fixed;}
-->
</style>