2013-11-28 111 views
-2

我無法將我的CSS樣式表:樣式錶鏈接尚未工作

層次:

的index.html:

// index.html 
<!DOCTYPE html> 
<html> 
    <head> 
    <link href="css/index.css" type="text/css" rel="stylesheet"> 
    </head> 
    <body> 
    <p class="blue">Hello</p> 
    </body> 
</html> 

index.css:

// index.css 
.blue { 
    font:blue; 
    font-size: 20px; 
} 
+0

你在控制檯或網絡標籤中看到了什麼? – SLaks

+0

如果index.css位於css文件夾中,並且css文件夾與index.html位於同一目錄中,那麼我發現您的樣式錶鏈接沒有問題。 – sheng

+0

是的,這個問題不在代碼本身中。它是我的後端框架。 – collinglass

回答

7

的「字體「屬性不正確。

嘗試更換此:

.blue { 
    font:blue; 
    font-size: 20px; 
} 

通過這樣的:

.blue { 
    color:blue; 
    font-size: 20px; 
} 

CSS的路徑似乎是正確的,你可以檢查你的瀏覽器控制檯的網絡選項卡上,如果你得到一個HTTP 200該文件被加載,如果404沒有找到。