<link rel="stylesheet" type="text/css" href="../styles.css"> 不工作
<link rel="stylesheet" type="text/css" href="../styles.css"> not working
Here's the Directory screenshot 1
Here's the Directory screenshot 2
我正在尝试构建一个 Twitter 克隆作为我的第一个 PHP 项目。但是我正面临这个问题;浏览器无法找到 CSS 文件。这是代码:
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../styles.css">
<title>Twitter</title>
</head>
styles.css 位于当前文件夹的上一级文件夹中。帮帮我!
如果您使用文档相关链接,您会很头疼。我总是让我的链接成为根目录,所以
/css/styles.css
或者你相对于 root 的任何路径而不是
../styles.css
我在我的职业生涯中遇到了很多由于移动和文档相关链接而导致的错误。
Here's the Directory screenshot 1 Here's the Directory screenshot 2 我正在尝试构建一个 Twitter 克隆作为我的第一个 PHP 项目。但是我正面临这个问题;浏览器无法找到 CSS 文件。这是代码:
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../styles.css">
<title>Twitter</title>
</head>
styles.css 位于当前文件夹的上一级文件夹中。帮帮我!
如果您使用文档相关链接,您会很头疼。我总是让我的链接成为根目录,所以
/css/styles.css
或者你相对于 root 的任何路径而不是
../styles.css
我在我的职业生涯中遇到了很多由于移动和文档相关链接而导致的错误。