html - 链接外部样式表
问题描述
我的所有东西都在样式标签中工作,但是一旦我将样式标签中的内容剪切并粘贴到 .css 并链接它,样式就停止工作了。我唯一能想到的是文件路径错误。我的 html 文件和样式表在同一个目录中。
这是我链接它的方式(这不起作用):
<head>
<title>Video Game Reviews</title>
<link rel="stylesheet" type="text/css" href="./mystyle.css">
</head>
这确实有效:
<head>
<style>
body {
background-color: rgb(255, 0, 255); /* this is the pink color */
color: black; /* color of font */
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; /* no tail font is more readable for small font */
font-size:16px;
}
</style>
</head>
解决方案
看到您的 CSS 文件中没有 HTML 标记。
推荐阅读
- node.js - 在 express-handlebars 中包含布局问题
- c# - 为什么对象的 list<> 属性为空
- vue.js - 在VueJS中向列表添加多个元素时添加过渡动画
- python - 如何将像“xe4\xb8\xad”这样的str变量转换为中文?
- php - 如何安排 cron 作业以每天提取数据库并通过邮件发送报告
- python - 为什么有 %26 (Python)?
- jestjs - 使用 Babel 和 Jest 在测试中启动 Web API 文件对象时出现问题
- python - 如何使用 django-rest-framework 中的序列化程序将相似数据合并到自定义字段中?
- java - 如何在 webflux ServerHttpRequest 中获取原始 url 路径
- swift - 将文件承诺从 NSView 拖到桌面或其他应用程序 (macOS)