html css 样式 sheet 的相对地址无效
html relative address to css style sheet not working
对于 raspberry pi 上的 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 link 有关?
css 文件不在根目录中,我会将其移动到 index.html 所在的同一目录中,或者如果您需要 css 文件夹,我会像这样创建它们
/var/www/index.html
/var/www/css/style.css
/var/www/php/someCode.php
对于 raspberry pi 上的 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 link 有关?
css 文件不在根目录中,我会将其移动到 index.html 所在的同一目录中,或者如果您需要 css 文件夹,我会像这样创建它们
/var/www/index.html
/var/www/css/style.css
/var/www/php/someCode.php