簡體   English   中英

HTML相對於CSS樣式表的地址不起作用

[英]html relative address to css style sheet not working

對於樹莓派上的apache服務器,我具有linux文件夾結構,如下所示:

/var/www/html/index.html
/var/www/css/style.css
/var/www/php/someCode.php

index.html如下:

<!DOCTYPE html>
<html>
<head>
 <title>Introducing CSS Not Working</title>
 <link href="../css/style.css" type="text/css"
 rel="stylesheet" />
</head>
<body>
 <h1>From Garden to Plate Not Working</h1>
 <p>A <i>potager</i> is a French term for an
 ornamental vegetable or kitchen garden ... </p>
 <h2>What to Plant</h2>
 <p>Plants are chosen as much for their functionality
 as for their color and form ... </p>
</body>
</html>

style.css如下:

body {
font-family: Arial, Verdana, sans-serif;}
h1, h2 {
color: red;}
p {
color: #665544;}

CSS不會影響HTML。 您知道為什么,我猜測與index.html的CSS鏈接有關嗎?

css文件不在根目錄下,我將其移到index.html所在的目錄中,或者如果您需要css文件夾,則可以這樣創建它們

/var/www/index.html
/var/www/css/style.css 
/var/www/php/someCode.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM