不工作-6ren"> 不工作-Here's the Directory screenshot 1 Here's the Directory screenshot 2我正在尝试构建一个 Twitter 克隆作为我的第一个 PHP 元-6ren">
gpt4 book ai didi

javascript - <链接 rel ="stylesheet"类型 ="text/css"href ="../styles.css"> 不工作

转载 作者:行者123 更新时间:2023-11-28 02:06:50 25 4
gpt4 key购买 nike

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

我在我的职业生涯中遇到了很多由于移动和文档相关链接而导致的错误。

关于javascript - <链接 rel ="stylesheet"类型 ="text/css"href ="../styles.css"> 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48970569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com