MozTW 討論區
https://forum.moztw.org/

關於CSS在PHP網頁上得連結問題
https://forum.moztw.org/viewtopic.php?f=13&t=14363
1 頁 (共 1 頁)

發表人:  guest [ 2006-06-02, 16:24 ]
文章主題 :  關於CSS在PHP網頁上得連結問題

<link rel="stylesheet" type="text/css" href="main_style.css">
這一行在 <head>和</head>裡面
可是在fx總是無法顯示...
請問為什麼呢?
伺服器環境:AppServ 2.5.5 + WindowsXP
錯誤訊息:
引言回覆:
錯誤: 應該要有選擇器(selector)。 由於有錯誤的選擇器(selector)所以略過規則組。
原始檔: http://localhost/main_style.css
行:1
----------------------
錯誤: 應該要有選擇器(selector)。 由於有錯誤的選擇器(selector)所以略過規則組。
原始檔: http://localhost/main_style.css
行:10
----------------------
錯誤: 搜尋「不正確的規則組的結尾 }」: 已到檔案結尾。
原始檔: http://localhost/main_style.css
行:11
----------------------

以上是 JavaScript 主控台的訊息!

main_style.css的內容:
代碼:
<style type="text/css">
<!--
body{
  background-image: url(./site_pic/back01.gif);
  background-repeat: repeat-y;
  background-color: black;
}

-->
</style>


P.S. 在IE中是正常的
是我有寫錯嗎?
感謝各位不吝賜教 :D

發表人:  xacid [ 2006-06-02, 20:34 ]
文章主題 : 

guest 寫:
main_style.css的內容:
代碼:
<style type="text/css">
<!--
body{
  background-image: url(./site_pic/back01.gif);
  background-repeat: repeat-y;
  background-color: black;
}

-->
</style>

.css 裡不能用 html 所以把 1, 2, 10, 11 行刪掉應該就可以了

發表人:  訪客 [ 2006-06-02, 23:31 ]
文章主題 : 

xacid 寫:
guest 寫:
main_style.css的內容:
代碼:
<style type="text/css">
<!--
body{
  background-image: url(./site_pic/back01.gif);
  background-repeat: repeat-y;
  background-color: black;
}

-->
</style>

.css 裡不能用 html 所以把 1, 2, 10, 11 行刪掉應該就可以了

是這樣喔@@"
所以我看到的範本應該是錯誤的範例
我去試試看
謝謝你^^

發表人:  訪客 [ 2006-06-02, 23:49 ]
文章主題 : 

的確是如此
我剛剛測試了
唉~看了學姐的範本是錯的@@a
謝謝大大指教
問題已經解決^^

發表人:  wini [ 2006-06-04, 15:37 ]
文章主題 : 

Anonymous 寫:
的確是如此
我剛剛測試了
唉~看了學姐的範本是錯的@@a
謝謝大大指教
問題已經解決^^

正確點來說, <style></style> 、 <!-- --> ,
這些是 HTML 的標籤,是不該出現在 CSS 規則中的,
而 CSS 的規則就是從 <style><!-- 後開始的,
也就是說,用 link 的方式時,其實已經不必用 <style><!-- --></style> 了,
因為 link 後的屬性 type 已經說明了那是 CSS ,
只有用在 HTML 檔案中才會需要加那個讓瀏覽器知道那是 CSS 。

(這是新手容易犯的錯,記下來,以後不要再犯就好。)

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/