none
background-attachment 在 iframe子页面里不好用 RRS feed

全部回复

  • 你好,

    能贴下详细代码吗?

    我这边测试没什么问题。

    我的代码:

    Page1:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <iframe src="TestForIframe.html"></iframe>
     </body>
    </html>

    Page2:

    <!DOCTYPE html>
    <html>
    <head>
        <style>
            body {
                background-image: url("1.PNG");
                background-repeat: no-repeat;
                background-attachment: fixed;
            }
        </style>
    </head>
    <body>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>The background-image scrolls with the page. Try to scroll down.</p>
        <p>If you do not see any scrollbars, try to resize the browser window.</p>
    </body>
    </html>

    结果:


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年1月11日 8:18