【发布时间】:2021-11-15 02:45:25
【问题描述】:
我正在使用 Sublime text 编写一些 HTML 和 CSS 文件。我已经创建了我的 index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta -->
<meta charset="UTF-8" />
<title>RainyDayBakes</title>
<!-- Styles -->
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1 style="text-align:center">RainyDayBakes</h1>
<nav style="text-align:center">
<a href=”C:\Users\sarah\Documents\Simmons\CS-321\page1.html”> About </a>
<a href=”page2.html”> Menu </a>
<a href=”page3.html”> Gallery </a>
<a href=”page4.html”> Order </a>
<a href=”page5.html”> Contact Us </a>
</nav>
<img src="cake.png" alt="oreo crumble cake" class="center">
<h3>Welcome to RainyDayBakes!</h3>
<p>We are a local bakery specializing in creative cakes, cupcakes and cookies!</p>
<p>In addition to being open daily we also offer custom ordered confections.</p>
<!-- Scripts -->
<script src="scripts/index.js"></script>
</body>
<footer>
</footer>
</html>
我的 page1.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>This is Page One </title>
</head>
<body>
</body>
<footer>
</footer>
</html>
还有我的 style.css:
<style>
h1 {
color:red;
}
</style>
当我尝试在 Chrome 中运行 index.html 时,指向 page1.html 的链接说它不存在,并且 CSS 不会显示。它们都在同一个文件夹中,我已经保存了所有文件,并且我正在 Chrome 上运行。我发现的所有其他解决方案都是指拼写错误,目录不同等,但如上所述,它们都在同一个文件夹中,我没有注意到拼写错误(但是当你是太接近你的代码)。
【问题讨论】: