MozTW 討論區

各項 Mozilla 相關軟體與技術討論
現在的時間是 2025-08-20, 00:02

所有顯示的時間為 UTC + 8 小時





發表新文章 回覆主題  [ 3 篇文章 ] 
發表人 內容
文章發表於 : 2006-03-23, 23:30 
離線

註冊時間: 2004-10-20, 21:21
文章: 26
來自: HKSAR
小弟正在試一些 css, 但發現有些怪現象.

先來兩段 code

代碼:
.heading {

   background-image: url(cap_content.gif);
   background-repeat: no-repeat;
   background-attachment: fixed;
   background-position: center center;
}


代碼:
...


<table width="100%" border="0">
  <tr>
    <td colspan="3" class="heading">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

...


我發現, 如果 background-repeat 和 background-attachment 同時在 css 內出現, 該幅背景圖在 firefox 1.5 / opera 9 preview 2 並不能顯示, 但在 IE 6 或 dreamweaver 8 卻沒有問題. 如果我將 background-repeat / background-attachment 任何一句刪除, 則背景圖可以在任何一個瀏覽器顯示.

想請教各位大大, 為什麼會出現這個現象? background-repeat 和 background-attachment 並不能共存的嗎?

謝~


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2006-03-24, 01:30 
離線

註冊時間: 2004-07-03, 22:04
文章: 444
可以啊!
你的問題也許是 position 的使用
用了 background-attachment: fixed; 位置的計算應該是相對於頁面,你的表格可能不在顯示範圍
http://www.w3.org/TR/CSS21/colors.html# ... attachment
引言回覆:
Even if the image is fixed, it is still only visible when it is in the content, padding or border area of the element. Thus, unless the image is tiled ('background-repeat: repeat'), it may be invisible.

W3C spec 有各種疑難雜症的解答啊!


回頂端
Mozilla/5.0 (X11; U; Linux i686; zh-TW; rv:1.7.11) Gecko/20050729
 個人資料  
引用回覆  
 文章主題 :
文章發表於 : 2006-03-24, 02:06 
離線

註冊時間: 2004-10-20, 21:21
文章: 26
來自: HKSAR
完全明白了. 謝~

我也有看 W3C 的 spec, 只是, 小弟英文實在爛到.... >.< 看不懂....


回頂端
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1
 個人資料  
引用回覆  
顯示文章 :  排序  
發表新文章 回覆主題  [ 3 篇文章 ] 

所有顯示的時間為 UTC + 8 小時


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 14 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯您的文章
不能 在這個版面刪除您的文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
Powered by phpBB® Forum Software © phpBB Group
正體中文語系由 竹貓星球 維護製作
© moztw.org, Mozilla Foundation
MozTW,Mozilla 台灣社群