使用CSS固定背景

  •   2009-07-31/13:25
  • 使用CSS可以固定背景,格式如下:
    标签名{background-attachment:参数}

    参数:
    fixed:页面滚动时,背景固定;
    scroll:页面滚动时,背景滚动。

    实例:

    <html>
    <style type="text/css">
    <!--
        p.1{ background-attachment:fixed;  background-repeat:no-repeat;background-image:url(mgc.jpg);font-size:100mm}
        p.2{ background-attachment:scroll;  background-repeat:no-repeat;background-image:url(mgc.jpg);font-size:100mm}
    -->
    </style>
    <head>
        <title>CSS</title>
    </head>
    <body>

        <p class="1">fixed</p>
        <p class="2">scroll</p>
       
    </body>
    </html>


    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多