<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # CSS background-position 屬性 ## 實例 如何定位背景圖像: ``` body { background-image:url('bgimage.gif'); background-repeat:no-repeat; background-attachment:fixed; background-position:center; } ``` ## 瀏覽器支持 | IE | Firefox | Chrome | Safari | Opera | | --- | --- | --- | --- | --- | 所有瀏覽器都支持 background-position 屬性。 注釋:任何版本的 Internet Explorer (包括 IE8)都不支持屬性值 "inherit"。 ## 定義和用法 background-position 屬性設置背景圖像的起始位置。 這個屬性設置背景原圖像(由 [background-image](/cssref/pr_background-image.asp "CSS background-image 屬性") 定義)的位置,背景圖像如果要重復,將從這一點開始。 提示:您需要把 background-attachment 屬性設置為 "fixed",才能保證該屬性在 Firefox 和 Opera 中正常工作。 | 默認值: | 0% 0% | | --- | --- | | 繼承性: | no | | --- | --- | | 版本: | CSS1 | | --- | --- | | JavaScript 語法: | _object_.style.backgroundPosition="center" | | --- | --- | ## 可能的值 | 值 | 描述 | | --- | --- | | * top left * top center * top right * center left * center center * center right * bottom left * bottom center * bottom right | 如果您僅規定了一個關鍵詞,那么第二個值將是"center"。 默認值:0% 0%。 | | x% y% | 第一個值是水平位置,第二個值是垂直位置。 左上角是 0% 0%。右下角是 100% 100%。 如果您僅規定了一個值,另一個值將是 50%。 | | xpos ypos | 第一個值是水平位置,第二個值是垂直位置。 左上角是 0 0。單位是像素 (0px 0px) 或任何其他的 CSS 單位。 如果您僅規定了一個值,另一個值將是50%。 您可以混合使用 % 和 position 值。 | ## TIY 實例 [如何放置背景圖像](/tiy/t.asp?f=csse_background-position) 本例演示如何在頁面上放置背景圖像。 ``` <html> <head> <style type="text/css"> body { background-image:url('/i/eg_bg_03.gif'); background-repeat:no-repeat; background-attachment:fixed; background-position:center; } </style> </head> <body> <body> <p><b>提示:</b>您需要把 background-attachment 屬性設置為 "fixed",才能保證該屬性在 Firefox 和 Opera 中正常工作。</p> </body> </body> </html> ``` [如何使用%來定位背景圖像](/tiy/t.asp?f=csse_background-position_percent) 本例演示如何使用百分比來在頁面上定位背景圖像。 ``` <html> <head> <style type="text/css"> body { background-image: url('/i/eg_bg_03.gif'); background-repeat: no-repeat; background-attachment:fixed; background-position: 30% 20%; } </style> </head> <body> <p><b>注釋:</b>為了在 Mozilla 中實現此效果,background-attachment 屬性必須設置為 "fixed"。</p> </body> </html> ``` [如何使用像素來定位背景圖像](/tiy/t.asp?f=csse_background-position_pixel) 本例演示如何使用像素來在頁面上定位背景圖像。 ``` <html> <head> <style type="text/css"> body { background-image: url('/i/eg_bg_03.gif'); background-repeat: no-repeat; background-attachment:fixed; background-position: 50px 100px; } </style> </head> <body> <p><b>注釋:</b>為了在 Mozilla 中實現此效果,background-attachment 屬性必須設置為 "fixed"。</p> </body> </html> ``` ## 相關頁面 CSS 教程:[CSS 背景](/css/css_background.asp "CSS 背景") CSS 參考手冊:[background-image 屬性](/cssref/pr_background-image.asp "CSS background-image 屬性") HTML DOM 參考手冊:[backgroundPosition 屬性](/jsref/prop_style_backgroundposition.asp "HTML DOM backgroundPosition 屬性")
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看